 |
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
Stagnate Guest
Offline
|
Posted: Sat Sep 16, 2006 2:26 pm Post subject: Python and MySQL |
 |
|
|
|
I have queries working, but the pyint declarations don't appear to match reality. It's entirely possible that I'm misreading the declarations or maybe working from old source (less likely).
From reldb.h:
int (*Query)(query_callback cb, void *clos, int notifyfail, const char *fmt, ...);
/* pyint: (int, db_res, clos -> void) dynamic failval 0, clos, int, string -> int */
|
It appears that the correct definition is (int, db_res) for the callback function (status and result) and (string, int, string) for the query (name of callback function, error notify(?), query string)
However I don't understand what dynamic failval 0 means. The int returned from the query seemed to increment in my first test, but never after that. Is it a status marker, an index of the query, or something else?
int (*EscapeString)(const char *str, char *buf, int buflen);
/* pyint: string, string out, int buflen -> int */
|
This seems to take a single argument in (string) and output a tuple (int status, escaped string).
Some other notes based on initial work...
First, the option of passing a pointer to handle query related data isn't available, but I think that a queue will work. Is there any circumstance where queries might return out of order?
Second, I can't get the MySQL error and python errors in the logs. It shows up on console. Is there something that I'm missing? I have log set to DIMWE.
Also, last_insert_id is not safe without careful handling, since multiple modules can do inserts. Is it possible to add a flag to the query to have it automatically return the insert ID to guarantee validity? Pretty low priority for me but handy. |
|
Back to top |
|
 |
Stagnate Guest
Offline
|
Posted: Sat Sep 16, 2006 2:36 pm Post subject: |
 |
|
|
|
I see that a pointer used to output data is not passed as an argument, but is in the output as a tuple, so the second issue is resolved. |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
Software by php BB © php BB Group Server Load: 56 page(s) served in previous 5 minutes.
|