Mercurial > repos > yufei-luo > s_mart
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commons/core/sql/OldRepetDB.py Fri Jan 18 04:54:14 2013 -0500 @@ -0,0 +1,27 @@ +import pyRepet.sql.RepetDBMySQL + + +class RepetDB ( pyRepet.sql.RepetDBMySQL.RepetDB ): + + #TODO: try + def execute( self, qry, params=None ): + if params == None: + self.cursor.execute( qry ) + else: + self.cursor.execute( qry, params ) + + + ## Record a new table in the 'info_table' table + # + # @param tablename table name + # @param info information on the origin of the table + # + def updateInfoTable( self, tablename, info ): + self.execute( """SHOW TABLES""" ) + results = self.fetchall() + if ("info_tables",) not in results: + sqlCmd = "CREATE TABLE info_tables ( name varchar(255), file varchar(255) )" + self.execute( sqlCmd ) + qryParams = "INSERT INTO info_tables VALUES (%s, %s)" + params = ( tablename, info ) + self.execute( qryParams,params )