Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ PennMUSH ➜ Compiling the server ➜ Calling an SQL Function

Calling an SQL Function

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Jamal   (20 posts)  Bio
Date Wed 07 Apr 2004 05:35 AM (UTC)
Message
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
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 07 Apr 2004 06:46 AM (UTC)
Message
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.




- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Jamal   (20 posts)  Bio
Date Reply #2 on Wed 07 Apr 2004 07:39 AM (UTC)
Message
That seemed to work. Thanks agian for your assistance.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,441 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.