Server Help

ASSS Questions - Python and MySQL

Anonymous - 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:
Code: Show/Hide

   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?

Code: Show/Hide

   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.
Anonymous - 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.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group