Question about mysql_insert_id
#4

Quote:
Originally Posted by ToiletDuck
View Post
What is the difference between
Code:
cache_insertid
and
Code:
mysq_insert_id
mysql_insert_id is completely deprecated and will never work with the latest MySQL release. If you do really want to know the difference, mysql_insert_id gets the ID generated for an AUTO_INCREMENT column by the latest sent query.

cache_insert_id works the same way as mysql_insert_id, except that it will not retrieve the ID if there isn't any active cache (you did not run threaded query or set an active cache manually) in the server. See the example on cache_insert_id in the SA-MP wiki. If you are interested with playing around and seeing which functions will lead to an active cache, use the cache_is_any_active native after you call something.

Quote:
Originally Posted by ToiletDuck
View Post
i have this code in my server
Code:
forward OnQueryInsertBaseObject(baseidx, objectid);
public OnQueryInsertBaseObject(baseidx, objectid)
	return BaseObjectData[baseidx][objectid][oSQLId] = mysql_insert_id(MainPipeline);
basically when the user execute a query to insert in the table this function is called and save the id into the variable
which is safer to use?
As I've said, mysql_insert_id is deprecated so avoid using it where possible. Use the latest plugin release, thread your queries, and switch to using a cached system. Then, use cache_insert_id() as a drop-in replacement to mysql_insert_id().
Reply


Messages In This Thread
Question about mysql_insert_id - by ToiletDuck - 09.02.2019, 17:05
Re: Question about mysql_insert_id - by ComDuck - 09.02.2019, 17:35
Re: Question about mysql_insert_id - by ToiletDuck - 09.02.2019, 17:53
Re: Question about mysql_insert_id - by ComDuck - 09.02.2019, 18:21
Re: Question about mysql_insert_id - by ToiletDuck - 09.02.2019, 18:40

Forum Jump:


Users browsing this thread: 2 Guest(s)