diff options
author | raylu <raylu@gridium.com> | 2013-05-03 03:41:50 -0700 |
---|---|---|
committer | raylu <raylu@gridium.com> | 2013-10-19 18:21:46 -0700 |
commit | 224f66a77aa3afa5e06daec656ae97f6e31e0592 (patch) | |
tree | f36843c32143c401ec1c6dccd502cddcbba6017c /db/__init__.py | |
download | ykill-224f66a77aa3afa5e06daec656ae97f6e31e0592.tar.xz |
start over
Diffstat (limited to 'db/__init__.py')
-rw-r--r-- | db/__init__.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/db/__init__.py b/db/__init__.py new file mode 100644 index 0000000..ead5232 --- /dev/null +++ b/db/__init__.py @@ -0,0 +1,15 @@ +import oursql + +from config import db as dbconfig + +conn = oursql.connect(host=dbconfig.host, db=dbconfig.database, user=dbconfig.user, passwd=dbconfig.password, autoreconnect=True) + +def ykill_cursor(): + return conn.cursor(oursql.DictCursor) + +def execute(cursor, sql, *values): + cursor.execute(sql, values) + +def query(cursor, sql, *values): + execute(cursor, sql, *values) + return cursor.fetchall() |