Mercurial > sqlpython
comparison sqlpyPlus.py @ 111:289b0a472b65
print results in describe
author | catherine@Elli.myhome.westell.com |
---|---|
date | Fri, 13 Jun 2008 15:53:03 -0400 |
parents | 38ee1ca92801 |
children | 5e57765073f4 6e346ae994b9 |
comparison
equal
deleted
inserted
replaced
110:1cd9ec129372 | 111:289b0a472b65 |
---|---|
414 result = ['<%s>\n%s\n</%s>' % | 414 result = ['<%s>\n%s\n</%s>' % |
415 (self.tblname, self.output_row_as_xml(row), self.tblname) | 415 (self.tblname, self.output_row_as_xml(row), self.tblname) |
416 for row in self.rows] | 416 for row in self.rows] |
417 return '\n'.join(result) | 417 return '\n'.join(result) |
418 | 418 |
419 html_template = """<html> | |
420 <head> | |
421 <title py:content="tblname">Table Name</title> | |
422 </head> | |
423 <body> | |
424 <table py:attr={'id':tblname}> | |
425 <tr> | |
426 <th py:for="colname in colnames"> | |
427 <span py:replace="colname">Column Name</span> | |
428 </th> | |
429 </tr> | |
430 <tr py:for="row in rows"> | |
431 <td py:for="itm in row"> | |
432 <span py:replace="str_or_empty(itm)">Value</span> | |
433 </td> | |
434 </tr> | |
435 </table> | |
436 </body> | |
437 </html>""" | |
419 def output_as_html_table(self): | 438 def output_as_html_table(self): |
420 result = ''.join('<th>%s</th>' % c for c in self.colnames) | 439 result = ''.join('<th>%s</th>' % c for c in self.colnames) |
421 result = [' <tr>\n %s\n </tr>' % result] | 440 result = [' <tr>\n %s\n </tr>' % result] |
422 for row in self.rows: | 441 for row in self.rows: |
423 result.append(' <tr>\n %s\n </tr>' % | 442 result.append(' <tr>\n %s\n </tr>' % |
427 result = '''<table id="%s"> | 446 result = '''<table id="%s"> |
428 %s | 447 %s |
429 </table>''' % (self.tblname, '\n'.join(result)) | 448 </table>''' % (self.tblname, '\n'.join(result)) |
430 return result | 449 return result |
431 | 450 |
451 #TODO: use serious templating to make these user-tweakable | |
452 | |
453 def output_as_markup(self, genshi_template): | |
454 return None | |
455 #self.tblname, self.colnames, self.rows | |
456 | |
432 def output_as_list(self, align): | 457 def output_as_list(self, align): |
433 result = [] | 458 result = [] |
434 colnamelen = max(len(colname) for colname in self.colnames) + 1 | 459 colnamelen = max(len(colname) for colname in self.colnames) + 1 |
435 for (idx, row) in enumerate(self.rows): | 460 for (idx, row) in enumerate(self.rows): |
436 result.append('\n**** Row: %d' % (idx+1)) | 461 result.append('\n**** Row: %d' % (idx+1)) |
588 self.do_select(q,bindVarsIn={'object_name':object_name, 'owner':owner}) | 613 self.do_select(q,bindVarsIn={'object_name':object_name, 'owner':owner}) |
589 elif object_type == 'PACKAGE': | 614 elif object_type == 'PACKAGE': |
590 self.curs.execute(descQueries['PackageObjects'][0], {'package_name':object_name, 'owner':owner}) | 615 self.curs.execute(descQueries['PackageObjects'][0], {'package_name':object_name, 'owner':owner}) |
591 packageContents = self.curs.fetchall() | 616 packageContents = self.curs.fetchall() |
592 for (packageObj_name,) in packageContents: | 617 for (packageObj_name,) in packageContents: |
593 print packageObj_name | 618 self.stdout.write(packageObj_name + '\n') |
594 self.do_select(descQueries['PackageObjArgs'][0],bindVarsIn={'package_name':object_name, 'owner':owner, 'object_name':packageObj_name}) | 619 self.do_select(descQueries['PackageObjArgs'][0],bindVarsIn={'package_name':object_name, 'owner':owner, 'object_name':packageObj_name}) |
595 do_desc = do_describe | 620 do_desc = do_describe |
596 | 621 |
597 def do_deps(self, arg): | 622 def do_deps(self, arg): |
598 object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper()) | 623 object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper()) |