Raised This Month: $ Target: $400
 0% 

SQL Question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Silencer123
Veteran Member
Join Date: Jul 2006
Old 06-06-2007 , 13:21   SQL Question
Reply With Quote #1

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!
__________________
EAT YOUR VEGGIES

Last edited by Silencer123; 06-06-2007 at 13:23.
Silencer123 is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 06-06-2007 , 13:49   Re: SQL Question
Reply With Quote #2

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.
__________________
Brad is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 06-06-2007 , 16:35   Re: SQL Question
Reply With Quote #3

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?
__________________
EAT YOUR VEGGIES
Silencer123 is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 06-06-2007 , 18:37   Re: SQL Question
Reply With Quote #4

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
__________________
Brad is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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