AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   SQL Question (https://forums.alliedmods.net/showthread.php?t=56090)

Silencer123 06-06-2007 13:21

SQL Question
 
How can I return a variables last used auto increment value, prefably with some dbi function?
I have been looking at dbi_nextrow but I am not sure if that is what I am looking for and even
if it is how would the Query which is needed to get a Result with dbi_query be looking like?
Thanks in advance!

Brad 06-06-2007 13:49

Re: SQL Question
 
I know you prefer the DBI functions but the new SQLx functions are much better, albeit a bit more complicated. If you were using the SQLx functions, you could just use SQL_GetInsertId(h_query).

I am not sure of how one would go about doing it with the old DBI functions.

Silencer123 06-06-2007 16:35

Re: SQL Question
 
Okay...
Let me guess, using SQL and DBI Functions at the
same time is like doing so with Engine and Fakemeta?
Well so I hopefully can change to SQL Functions fast
because they are "much better" - whatever that means
exactly. However, I will do so. One Question: SQL_GetInstertId
requires a Query - would that Query be somehow "faked" to
get the InsertId or will it actually be executed and equals
the SQL_Execute Function just with a different return value?
And how can I tell in the Query what Variable/Column
shall be looked up?

Brad 06-06-2007 18:37

Re: SQL Question
 
The DBI functions are not multi-threaded, meaning they have the potential to lag your server everytime you do a query. The SQLx functions are multi-threaded and thus, won't lag your server. That, in itself, is a reason to use SQLx over DBI.

I think Emp wrote a tutorial of sorts in the Code Snippets board. There's also something or another somewhere that BAILOPAN wrote. Either should help you get up to speed. Here's some useful reading: http://wiki.alliedmods.net/AMX_Mod_X..._Changes#Usage

What SQL_GetInsertID needs is the handle to a query that you already submitted.

I suggest you familiarize yourself with these functions: http://www.amxmodx.org/funcwiki.php?go=inc&id=50


All times are GMT -4. The time now is 10:31.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.