Created
June 11, 2013 21:19
-
-
Save koalahamlet/5760799 to your computer and use it in GitHub Desktop.
that one thing I wanted to show ryan.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import MySQLdb | |
class Database1(object): | |
host = "localhost" | |
user = "root" | |
password = "" | |
db = "teachscape_focus" | |
"""docstring for Database""" | |
def __init__(self): | |
super(Database, self).__init__() | |
self.connection = MySQLdb.connect ( host = self.host, user = self.user, passwd = self.password, db = self.db) | |
def query(self, query): | |
cursor = self.connection.cursor(MySQLdb.cursors.DictCursor) | |
cursor.execute (query) | |
return cursor.fetchall() | |
def __del__(self): | |
self.connection.close() | |
class Database2(object): | |
host = "localhost" | |
user = "root" | |
password = "" | |
db = "teachscape_leapfrog" | |
"""docstring for Database""" | |
def __init__(self): | |
super(Database, self).__init__() | |
self.connection = MySQLdb.connect ( host = self.host, user = self.user, passwd = self.password, db = self.db) | |
def query(self, query): | |
cursor = self.connection.cursor(MySQLdb.cursors.DictCursor) | |
cursor.execute (query) | |
return cursor.fetchall() | |
def __del__(self): | |
self.connection.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment