iro/database.py
changeset 302 3f4bdea2abbf
parent 90 eb04ac3a8327
parent 301 d5ebbcccc41b
child 303 9708742ff89c
--- a/iro/database.py	Wed Dec 21 22:07:48 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import MySQLdb
-import sqlite3
-class Database(object):
-    def __init__(self,connection):
-        self.conn=None
-        self.cursor=None
-        self.connection=connection
-        self.testConnection()
-
-    def testConnection(self):
-        self.connect()
-        self.disconnect()
-
-    def getConn(self):
-        return self.conn
-
-    def getCursor(self):
-        return self.cursor
-
-    def connect(self):
-        if not self.getConn():
-            if (self.connection['type']=='mysql'):
-                self.conn=MySQLdb.connect(
-                    host   = self.connection["host"],
-                    db     = self.connection["db"],
-                    user   = self.connection["user"],
-                    passwd = self.connection["passwd"],
-                    )
-            if (self.connection['type']=='sqlite'):
-                self.conn=sqlite3.connect(self.connection['path'])
-
-        if not self.getCursor():
-            self.cursor = self.conn.cursor()
-
-    def disconnect(self):
-        if self.getCursor():
-            self.cursor.close()
-        self.cursor=None
-        if self.getConn():
-            self.conn.close()
-        self.conn=None
-
-