Mercurial > repos > yufei-luo > s_mart
comparison commons/core/sql/OldRepetDB.py @ 6:769e306b7933
Change the repository level.
author | yufei-luo |
---|---|
date | Fri, 18 Jan 2013 04:54:14 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
5:ea3082881bf8 | 6:769e306b7933 |
---|---|
1 import pyRepet.sql.RepetDBMySQL | |
2 | |
3 | |
4 class RepetDB ( pyRepet.sql.RepetDBMySQL.RepetDB ): | |
5 | |
6 #TODO: try | |
7 def execute( self, qry, params=None ): | |
8 if params == None: | |
9 self.cursor.execute( qry ) | |
10 else: | |
11 self.cursor.execute( qry, params ) | |
12 | |
13 | |
14 ## Record a new table in the 'info_table' table | |
15 # | |
16 # @param tablename table name | |
17 # @param info information on the origin of the table | |
18 # | |
19 def updateInfoTable( self, tablename, info ): | |
20 self.execute( """SHOW TABLES""" ) | |
21 results = self.fetchall() | |
22 if ("info_tables",) not in results: | |
23 sqlCmd = "CREATE TABLE info_tables ( name varchar(255), file varchar(255) )" | |
24 self.execute( sqlCmd ) | |
25 qryParams = "INSERT INTO info_tables VALUES (%s, %s)" | |
26 params = ( tablename, info ) | |
27 self.execute( qryParams,params ) |