Raised This Month: $ Target: $400
 0% 

SQLx and arrays


Post New Thread Reply   
 
Thread Tools Display Modes
Sputnik53
Senior Member
Join Date: Jun 2005
Old 11-28-2008 , 16:05   Re: SQLx and arrays
Reply With Quote #11

Quote:
Originally Posted by |PJ| Shorty View Post
a function like in php is not accessable.
you have to save the results manually like:
Code:
 
new g_var[10][36]
...
SQL_ReadResult(Query,0,g_var[0],35);
SQL_ReadResult(Query,1,g_var[1],35);
SQL_ReadResult(Query,2,g_var[2],35);
 
... and so on
example for strings...
Oh alright thanks.
Sputnik53 is offline
Sputnik53
Senior Member
Join Date: Jun 2005
Old 11-29-2008 , 09:12   Re: SQLx and arrays
Reply With Quote #12

Well I tried creating a function to read the full row but ran into a problem when returning the array through the function.

PHP Code:
public sql_row(Handle:con, const sql[]) {
    new 
Handle:queryresult;
    new 
row[33][128];
    
query SQL_PrepareQuery(con,sql);
    if(!
SQL_Execute(query)) {
        
server_print("%s :: MySQL query failed, stopping plugin"PLUGIN);
        
SQL_QueryError(query,sql_error,511);
        
set_fail_state(sql_error);
    }
    for(new 
0SQL_NumColumns(query); i++) {
        
SQL_ReadResult(query,i,row[i],127);
    }
    
SQL_FreeHandle(query);
    return 
row// doesn't quite works this way I guess :(

Sputnik53 is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 11-29-2008 , 14:03   Re: SQLx and arrays
Reply With Quote #13

No, SQLx will take it's time in querying and come back, that is sorta the point so it doesn't hang. I mean it's fast but if there is some sort of hang for the server to talk to it, it wont wait up, the rest of the plugin goes, or that's how Hawk explained it and it seems right.

--- Random ---
This was my 1337 Post LOL! WIN!
Styles is offline
Send a message via AIM to Styles
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-29-2008 , 15:07   Re: SQLx and arrays
Reply With Quote #14

Did you try this:
Code:
new row[33][128] = sql_row(...);
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 08:30.


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