Dave Britton
dave at davebritton.com
Fri Mar 17 09:13:15 EST 2006
I use MySQL with the Dustman MySQLdb interface, for example a typical mod_python publisher delivered module might have: ======================= from MySQLdb import * def csql(): dbc=connect('localhost', 'mysqluser') c=cursors.DictCursor(dbc) c.execute("use thisdatabase") return (c, dbc) # def index(req,userid=''): c,dbc=csql() if userid=='': userid=getnewlogin() # assigns a new userid string c.execute("select * from userdata where userid=%s",(userid)) userdata=c.fetchone() dbc.close() if userdata.has_key('userfirstname'): return "Hello, %s"%userdata['userfirstname'] else: return ("Unrecognized user id") ===================== It all seems pretty easy once I figured out how to do it, but I have always felt that SQL is a sad abomination, designed by IBM to create legions of database administrators. I wish there was a solid multiuser-safe object-oriented database or even a good procedural language relational DB like dBASE use to be. -Dave ----- Original Message ----- From: marinus van aswegen To: mod_python at modpython.org Sent: Friday, March 17, 2006 4:00 AM Subject: [mod_python] Which Database? Hi All Having sorted out mod_python code I new move on to the database :) I've been playing with mysql via _mysql. Before I get into using this module I thought I'd ask the obvious question "what database do you like to use and what module to you use to interface?" I know this is a bit open ended, but I thought let me gauge what ppl like to use. Regs Marinus ------------------------------------------------------------------------------ _______________________________________________ Mod_python mailing list Mod_python at modpython.org http://mailman.modpython.org/mailman/listinfo/mod_python -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20060317/76b6ae4d/attachment-0001.html
|