comparison sqlpyPlus.py @ 47:46b7b31dc395

feedback should print, not stdout
author catherine.devlin@gmail.com
date Tue, 01 Apr 2008 16:58:13 -0400
parents ad41f6a577f7
children ce2b64554091
comparison
equal deleted inserted replaced
46:ad41f6a577f7 47:46b7b31dc395
509 self.curs.execute(self.query, self.varsUsed) 509 self.curs.execute(self.query, self.varsUsed)
510 self.rows = self.curs.fetchmany(min(self.maxfetch, (rowlimit or self.maxfetch))) 510 self.rows = self.curs.fetchmany(min(self.maxfetch, (rowlimit or self.maxfetch)))
511 self.desc = self.curs.description 511 self.desc = self.curs.description
512 self.rc = self.curs.rowcount 512 self.rc = self.curs.rowcount
513 if self.rc > 0: 513 if self.rc > 0:
514 self.stdout.write('\n' + self.output(terminator, rowlimit) + '\n') 514 print '\n' + self.output(terminator, rowlimit)
515 if self.rc == 0: 515 if self.rc == 0:
516 self.stdout.write('\nNo rows Selected.\n\n') 516 print '\nNo rows Selected.\n'
517 elif self.rc == 1: 517 elif self.rc == 1:
518 self.stdout.write('\n1 row selected.\n\n') 518 print '\n1 row selected.\n'
519 if self.autobind: 519 if self.autobind:
520 self.binds.update(dict(zip([''.join(l for l in d[0] if l.isalnum()) for d in self.desc], self.rows[0]))) 520 self.binds.update(dict(zip([''.join(l for l in d[0] if l.isalnum()) for d in self.desc], self.rows[0])))
521 if len(self.desc) == 1: 521 if len(self.desc) == 1:
522 self.binds['_'] = self.rows[0][0] 522 self.binds['_'] = self.rows[0][0]
523 elif self.rc < self.maxfetch: 523 elif self.rc < self.maxfetch:
524 self.stdout.write('\n%d rows selected.\n\n' % self.rc) 524 print '\n%d rows selected.\n' % self.rc
525 else: 525 else:
526 self.stdout.write('\nSelected Max Num rows (%d)\n' % self.rc) 526 print '\nSelected Max Num rows (%d)' % self.rc
527 except Exception, e: 527 except Exception, e:
528 print e 528 print e
529 import traceback 529 import traceback
530 traceback.print_exc(file=sys.stdout) 530 traceback.print_exc(file=sys.stdout)
531 self.sqlBuffer.append(self.query) 531 self.sqlBuffer.append(self.query)