Author |
Message |
UKillMe Guest
Offline
|
Posted: 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? |
|
Back to top |
|
|
i88gerbils Oldbie Server Help
Gender: Joined: Dec 13 2002 Posts: 423 Location: OH Offline
|
Posted: Sun Oct 23, 2005 11:49 am Post subject: |
|
|
|
|
Hmm, I don't see anything in reldb.h that notes it supports Python. _________________ Oldbie Server Help |
|
Back to top |
|
|
UKillMe Guest
Offline
|
Posted: 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? |
|
Back to top |
|
|
Grelminar Creator of Asss
Joined: Feb 26 2003 Posts: 378 Offline
|
Posted: 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. |
|
Back to top |
|
|
UKillMe Guest
Offline
|
Posted: Sun Oct 23, 2005 10:48 pm Post subject: |
|
|
|
|
Cool, thanks a lot Grel. |
|
Back to top |
|
|
Grelminar Creator of Asss
Joined: Feb 26 2003 Posts: 378 Offline
|
Posted: 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. |
|
Back to top |
|
|
Guest
Offline
|
Posted: 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 |
|
Back to top |
|
|
Grelminar Creator of Asss
Joined: Feb 26 2003 Posts: 378 Offline
|
Posted: Mon Oct 24, 2005 1:32 pm Post subject: |
|
|
|
|
Ok, I'd consider that a legitimate use for mysql. |
|
Back to top |
|
|
|