diff options
| author | yo mama <pepper@scannerjammer.com> | 2015-04-30 15:08:01 -0700 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2015-04-30 15:08:01 -0700 |
| commit | 03f45bb4225740f2ebe4adfd8de24f67d33ee0e3 (patch) | |
| tree | f555265c798f7d1dff25315e79eb90055f4bab74 /db.py | |
| parent | da8255b0ad5703837c315c082a6f69edc47754a7 (diff) | |
good
Diffstat (limited to 'db.py')
| -rwxr-xr-x | db.py | 31 |
1 files changed, 0 insertions, 31 deletions
@@ -1,31 +0,0 @@ -import MySQLdb -USER = "asdfus" -PASSWORD = "gTYgT&M6q" -DATABASE = "asdfus" - -class db: - def __init__ (self): - self.conn = None - self.cursor = None - self.connect() - - def connect (self): - self.conn = MySQLdb.connect (host = "localhost", - user = USER, - passwd = PASSWORD, - db = DATABASE - ) - self.cursor = self.conn.cursor () - - def execute (self,sql,args=()): - try: - self.cursor.execute(sql,args) - except MySQLdb.Error, e: - print "Error %d: %s" % (e.args[0], e.args[1]) - # sys.exit (1) - self.connect() - self.cursor.execute(sql,args) - - def lastinsertid (self): - return DB.conn.insert_id() - |
