Server Help

ASSS Custom Projects - MySQL module in PY

Anonymous - Sun Oct 23, 2005 7:08 am
Post subject: MySQL module in PY
Hiya,

Trying to write a module that uses the I_RELDB interface from the mysql module to do some basic querying on a mysql server, but I'm running into a problem where it can't evaluate the I_RELDB name in

db = get_interface(I_RELDB)

after doing a

from asss import *

I've tried importing from "reldb" and from "mysql" and it says there are no modules with those names. Help?
i88gerbils - Sun Oct 23, 2005 11:49 am
Post subject:
Hmm, I don't see anything in reldb.h that notes it supports Python.
Anonymous - Sun Oct 23, 2005 12:08 pm
Post subject:
Well I've just started messing around with ASSS so I'm not all that familiar with it. I didn't realize that I could only use some of the interfaces in Py. Can anyone confirm?
Grelminar - Sun Oct 23, 2005 10:44 pm
Post subject:
Yes, not all interfaces are available in python. They need special directives to the glue generating script, in comments. See game.h for example. The python stuff didn't used to support callbacks, which the reldb interface uses, so it wasn't possible, but it might be now. I'll look into it. If you want, you can file a bug, so I don't forget.
Anonymous - Sun Oct 23, 2005 10:48 pm
Post subject:
Cool, thanks a lot Grel.
Grelminar - Mon Oct 24, 2005 1:53 am
Post subject:
Done. This is available in the latest source. The catch is that the parameter substitutions in Query don't work, so I added an explicit EscapeString function. It would be relatively easy to wrap Query and EscapeString in a library function that duplicates the parameter substitution feature.

But: I shouldn't leave without asking what you're using mysql for. If you're storing information about players, or arenas, or small global state, you should be using the persistent data feature instead. You'll get better integration into the rest of the server, automatic serialization, and automatic history, with much less code to write.
Anonymous - Mon Oct 24, 2005 2:14 am
Post subject:
It's a module to sign players up in the database for HZ's league site, which is a MySQL server sa_tongue.gif
Grelminar - Mon Oct 24, 2005 1:32 pm
Post subject:
Ok, I'd consider that a legitimate use for mysql.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group