Calling an SQL Function

Posted by Jamal on Wed 07 Apr 2004 05:35 AM — 3 posts, 15,092 views.

#0
The MUSH I'm working on as an addon to use MYSQL mushside. After investigating, I found that the calling function is:

int sql_query(dbref player, char *q_string, char row_delim, char field_delim, char *buff, char **bp)

Now, I'm pretty sure I understand the first four args, but I'm confused about the last two. What sort variables do I need to declare to send into the function? Thanks
Australia Forum Administrator #1
Well, buff sounds like a character array, and bp a pointer to a character array. Without knowing the documentation for it, something like this should work ...


dbref player;
char * q_string = "select blah from blah";
char row_delim = '\n';
char field_delim = ',';
char buff [1000];
char * bp;

int result;

result = sql_query (player, q_string, row_delim, field_delim, buff, &bp);


By passing down the address of bp you are passing a pointer to a pointer - I presume this is so the function can put a pointer into bp for you.



#2
That seemed to work. Thanks agian for your assistance.