annotate commons/core/sql/OldRepetDB.py @ 16:6135c3075bc5

Deleted selected files
author m-zytnicki
date Mon, 22 Apr 2013 11:09:41 -0400
parents 769e306b7933
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
1 import pyRepet.sql.RepetDBMySQL
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
2
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
3
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
4 class RepetDB ( pyRepet.sql.RepetDBMySQL.RepetDB ):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
5
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
6 #TODO: try
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
7 def execute( self, qry, params=None ):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
8 if params == None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
9 self.cursor.execute( qry )
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
10 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
11 self.cursor.execute( qry, params )
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
12
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
13
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
14 ## Record a new table in the 'info_table' table
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
15 #
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
16 # @param tablename table name
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
17 # @param info information on the origin of the table
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
18 #
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
19 def updateInfoTable( self, tablename, info ):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
20 self.execute( """SHOW TABLES""" )
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
21 results = self.fetchall()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
22 if ("info_tables",) not in results:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
23 sqlCmd = "CREATE TABLE info_tables ( name varchar(255), file varchar(255) )"
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
24 self.execute( sqlCmd )
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
25 qryParams = "INSERT INTO info_tables VALUES (%s, %s)"
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
26 params = ( tablename, info )
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
27 self.execute( qryParams,params )