Raised This Month: $51 Target: $400
 12% 

SQL_ReadResult to read string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tonykaram1993
Senior Member
Join Date: Mar 2013
Location: This World
Old 05-24-2016 , 14:19   SQL_ReadResult to read string
Reply With Quote #1

Hello,

I have the follwing query:
"formatex( strQuery, charsmax( strQuery ), "SELECT Salt FROM Player WHERE ( Player.SteamID = %s )", strPlayerAuthID );"

Now if I understand MySQL correctly, this should return the string called Salt of that player. My question is, how do I go about to read that result?

I saw this in the include files:
Code:
/**
 * Retrieves the current result.
 * A successful query starts at the first result,
 *  so you should not call SQL_NextRow() first.
 * Passing no extra params - return int
 * Passing one extra param - return float in 1st extra arg
 * Passing two extra params - return string in 1st arg, max length in 2nd
 * Example:
 *  new num = SQL_ReadResult(query, 0)
 *  new Float:num2
 *  new str[32]
 *  SQL_ReadResult(query, 1, num2)
 *  SQL_ReadResult(query, 2, str, 31)
 */
native SQL_ReadResult(Handle:query, column, any:...);
My query does not return a row, but rather a single entry (the string salt), so I should do the following correct? Correct me if I am wrong please.
Code:
SQL_ReadResult( hQuery, 0, strSalt, charsmax( strSalt ) );
Thank you!
__________________
My Plugins:
UltimatePlugin
UltimateSurf
UltimateAdmin
Code:
rcon version | rcon amxx version | rcon meta version
rcon amxx plugins | rcon meta list | rcon status
I AM INACTIVE ON THIS FORUM - For direct contact: [email protected]
tonykaram1993 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-24-2016 , 14:58   Re: SQL_ReadResult to read string
Reply With Quote #2

Passing two extra params - return string in 1st arg, max length in 2nd

Read what you posted.
__________________
HamletEagle is offline
tonykaram1993
Senior Member
Join Date: Mar 2013
Location: This World
Old 05-26-2016 , 09:53   Re: SQL_ReadResult to read string
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
Passing two extra params - return string in 1st arg, max length in 2nd

Read what you posted.
That was not what I was asking about. I already know that if I want to read it into a string, I have to pass the string with its length. I am talking about the column part. Since I am only getting one value (hence only 1 column), I should pass 0 as the column value. Right?
__________________
My Plugins:
UltimatePlugin
UltimateSurf
UltimateAdmin
Code:
rcon version | rcon amxx version | rcon meta version
rcon amxx plugins | rcon meta list | rcon status
I AM INACTIVE ON THIS FORUM - For direct contact: [email protected]
tonykaram1993 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 05-26-2016 , 12:54   Re: SQL_ReadResult to read string
Reply With Quote #4

Yes, the second parameter tells which column to pull data from, where 0 is the first one.

Why didn't you just try it by yourself?
klippy 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 03:48.


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