comparison mysqlpy.py @ 4:23c3a58d7804

about to strip out tselect
author devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil
date Tue, 04 Dec 2007 16:28:55 -0500
parents 8fa146b9a2d7
children 65ae6cec71c6
comparison
equal deleted inserted replaced
3:cd23cd62de3c 4:23c3a58d7804
107 except Exception, e: 107 except Exception, e:
108 print e 108 print e
109 109
110 def do_tselect(self, arg, rowlimit=None): 110 def do_tselect(self, arg, rowlimit=None):
111 '''executes a query and prints the result in trasposed form. Useful when querying tables with many columns''' 111 '''executes a query and prints the result in trasposed form. Useful when querying tables with many columns'''
112 self.query = sqlpython.Statement('select '+arg).query 112 self.query = 'select ' + arg # sqlpython.finishStatement('select '+arg)
113 (self.query, terminator, rowlimit) = sqlpython.findTerminator(self.query)
113 try: 114 try:
114 print self.query
115 self.curs.execute(self.query) 115 self.curs.execute(self.query)
116 rows = self.curs.fetchmany(min(self.maxtselctrows, rowlimit or self.maxtselctrows)) 116 rows = self.curs.fetchmany(min(self.maxtselctrows, rowlimit or self.maxtselctrows))
117 desc = self.curs.description 117 desc = self.curs.description
118 self.rc = self.curs.rowcount 118 self.rc = self.curs.rowcount
119 rows.insert(0,[desc[x][0] for x in range(len(desc))]) # adds column name to the row set 119 rows.insert(0,[desc[x][0] for x in range(len(desc))]) # adds column name to the row set