It was me that made the request. I'm kind of hanging on having the MySQLdb as the glue between the database, Python and the Flash swf front-end. I can live without the other modules and work around not having XML if need be, but MySQLdb is fairly fundamental. I understand its been busy with PHP etc., but when you do have a chance it would be appreciated. Thanks *Face for raising this - I was giving up hope and thinking I might have to find a new home.
Edit:
I just saw the post from *Face asking for help on Python.
The following simple script might help. Just put in in the cgi-bin (with 711) and either name it with a .cgi extension. You just have to pass the parameters - database name, user name, password, and a SQL statement, and it will return the results of the SQL statement.
WARNING - I would not use this 'live' - modify it to suit you, but it isn't a good idea to allow access to full SQL query - I usually hardcode the "SELECT xx FROM xx WHERE" and have the remainder passed from the client side - you can join the two bits together in the Python cgi script - easy ->
prefix = "SELECT * FROM myDatabase WHERE "
stmt = prefix + incomingSnippet
cursor.execute(stmt)
<- Python is nice and easy (and very powerful) - its worth the effort of learning.
Here's the simple version of the cgi script - all the modules are part of the standard Python package except the MySQLdb module (which has to be installed by administrator).
->
#!/usr/bin/env python
from SimpleXMLRPCServer import CGIXMLRPCRequestHandler
import MySQLdb
import string
class Pyro:
def pydb(self, mydb, mypw, myusr, stmt, data):
db=MySQLdb.Connect(db=mydb, host='localhost', user=myusr, passwd=mypw)
cursor=db.cursor()
cursor.execute(stmt)
data=cursor.fetchall()
cursor.close()
db.close()
return data
else:
return "no command given"
pdb = Pyro() #create an instance of the class
handler = CGIXMLRPCRequestHandler() #create the handler
handler.register_instance(pdb) #register the instance as a web service
handler.handle_request() #start accepting requests
Edit:
PS - some of the indentation has been lost when posting this - it matters! If you 're not sure about Python indentation, email me on dan()law()nz()gmail()com.
Edit:
Corey, my apologies - I see you asked for some information linking to the MySQLdb module -
MySQLdb can be got from
http://sourceforge.net/project/showfiles.php?group_id=22307
It is the 'standard' MySQL API for Python - lots more info from Google.