Mercurial > sqlpython
changeset 62:833e9d251da3
add head
author | catherine@cordelia |
---|---|
date | Thu, 03 Apr 2008 11:42:40 -0400 |
parents | 1eefe17b3630 |
children | 16618ff91c63 |
files | sqlpyPlus.py |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/sqlpyPlus.py Thu Apr 03 11:21:26 2008 -0400 +++ b/sqlpyPlus.py Thu Apr 03 11:42:40 2008 -0400 @@ -726,6 +726,20 @@ def do__dir_schemas(self, arg): self.do_select("""owner, count(*) AS objects FROM all_objects GROUP BY owner ORDER BY owner""") + def do_head(self, arg): + nrows = 10 + args = arg.split() + if len(args) > 1: + for a in args: + if a[0] == '-': + try: + nrows = int(a[1:]) + args.remove(a) + except: + pass + arg = ' '.join(args) + self.do_select('* from %s;%d' % (arg, nrows)) + def do_print(self, arg): 'print VARNAME: Show current value of bind variable VARNAME.' if arg: