add wrappers for fpdb_db methods (plan is to move the fpdb_db methods into Database)
This commit is contained in:
		
							parent
							
								
									04b9dd9126
								
							
						
					
					
						commit
						cb1a4d2d0a
					
				|  | @ -40,7 +40,7 @@ import Card | |||
| 
 | ||||
| class Database: | ||||
|     def __init__(self, c, db_name = None, game = None, sql = None): # db_name and game not used any more | ||||
|         print "creating Database instance, sql =", sql | ||||
|         print "\ncreating Database instance, sql =", sql | ||||
|         self.fdb = fpdb_db.fpdb_db()   # sets self.fdb.db self.fdb.cursor and self.fdb.sql | ||||
|         self.fdb.do_connect(c) | ||||
|         self.connection = self.fdb.db | ||||
|  | @ -87,6 +87,8 @@ class Database: | |||
|         #row = cur.fetchone() | ||||
|         self.saveActions = False if self.import_options['saveActions'] == False else True | ||||
| 
 | ||||
|     def do_connect(self, c): | ||||
|         self.fdb.do_connect(c) | ||||
| 
 | ||||
|     def commit(self): | ||||
|         self.fdb.db.commit() | ||||
|  | @ -94,6 +96,19 @@ class Database: | |||
|     def close_connection(self): | ||||
|         self.connection.close() | ||||
| 
 | ||||
|     def disconnect(self, due_to_error=False): | ||||
|         """Disconnects the DB (rolls back if param is true, otherwise commits""" | ||||
|         self.fdb.disconnect(due_to_error) | ||||
|      | ||||
|     def reconnect(self, due_to_error=False): | ||||
|         """Reconnects the DB""" | ||||
|         self.fdb.reconnect(due_to_error=False) | ||||
|      | ||||
|     def get_backend_name(self): | ||||
|         """Reconnects the DB""" | ||||
|         return self.fdb.get_backend_name() | ||||
|          | ||||
| 
 | ||||
|     def get_table_name(self, hand_id): | ||||
|         c = self.connection.cursor() | ||||
|         c.execute(self.sql.query['get_table_name'], (hand_id, )) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user