# HG changeset patch
# User catherine@dellzilla
# Date 1225226691 14400
# Node ID 3ce72ea76768f865c668dc0d61e0e9c3a681be1e
# Parent 87eb1c6ed59b559f07d8ed0104a384fe777b1b57
adding tests
diff -r 87eb1c6ed59b -r 3ce72ea76768 sqlpython/exampleSession.txt
--- a/sqlpython/exampleSession.txt Tue Oct 28 16:12:58 2008 -0400
+++ b/sqlpython/exampleSession.txt Tue Oct 28 16:44:51 2008 -0400
@@ -57,6 +57,179 @@
Executed
-#testschema@eqtest> drop table play;
+testschema@eqtest> comments play
+TABLE TESTSCHEMA.PLAY: I like plays.
+
+COLUMN_NAME COMMENTS
+----------- ----------------------------
+TITLE None
+AUTHOR Primary author (if multiple)
+
+2 rows selected.
+
+testschema@eqtest> cat play
+
+TITLE AUTHOR
+------------- -----------
+Twelfth Night Shakespeare
+The Tempest Shakespeare
+Agamemnon Aeschylus
+
+3 rows selected.
+
+testschema@eqtest> help terminators
+; standard Oracle format
+\c CSV (with headings)
+\C CSV (no headings)
+\g list
+\G aligned list
+\h HTML table
+\i INSERT statements
+\s CSV (with headings)
+\S CSV (no headings)
+\t transposed
+\x XML
+\l line plot, with markers
+\L scatter plot (no lines)
+\b bar graph
+\p pie chart
+testschema@eqtest> select * from play where author='Shakespeare'\c
+
+"TITLE","AUTHOR"
+"Twelfth Night","Shakespeare"
+"The Tempest","Shakespeare"
+
+2 rows selected.
+
+testschema@eqtest> select * from play where author='Shakespeare'\g
+
+
+
+**** Row: 1
+TITLE: Twelfth Night
+AUTHOR: Shakespeare
+
+**** Row: 2
+TITLE: The Tempest
+AUTHOR: Shakespeare
+
+
+2 rows selected.
+
+testschema@eqtest> select * from play where author='Shakespeare'\h
-Executed
\ No newline at end of file
+
+
+
+ play
+
+
+
+
+
+
+
+
+
+ Twelfth Night
+ |
+ Shakespeare
+ |
+
+
+ The Tempest
+ |
+ Shakespeare
+ |
+
+
+
+
+
+2 rows selected.
+
+testschema@eqtest> select * from play where author='Shakespeare'\i
+
+INSERT INTO play (TITLE,AUTHOR) VALUES ('Twelfth Night','Shakespeare');
+INSERT INTO play (TITLE,AUTHOR) VALUES ('The Tempest','Shakespeare');
+
+2 rows selected.
+
+testschema@eqtest> select * from play where author='Shakespeare'\t
+
+
+COLUMN NAME ROW N.1 ROW N.2
+----------- ------------- -----------
+TITLE Twelfth Night The Tempest
+AUTHOR Shakespeare Shakespeare
+
+2 rows selected.
+
+testschema@eqtest> select * from play where author='Shakespeare'\x
+
+
+
+
+
+ Twelfth Night
+ Shakespeare
+
+
+ The Tempest
+ Shakespeare
+
+
+
+
+2 rows selected.
+
+testschema@eqtest> set
+maxtselctrows: 10
+maxfetch: 1000
+autobind: False
+failover: False
+timeout: 30
+commit_on_exit: True
+testschema@eqtest> set autobind on
+autobind - was: False
+now: True
+testschema@eqtest> select * from play where author like 'A%';
+
+TITLE AUTHOR
+--------- ---------
+Agamemnon Aeschylus
+
+1 row selected.
+
+testschema@eqtest> print
+:title = Agamemnon
+:author = Aeschylus
+testschema@eqtest> select * from play where author = :author;
+
+TITLE AUTHOR
+--------- ---------
+Agamemnon Aeschylus
+
+1 row selected.
+
+testschema@eqtest> help grep
+grep PATTERN TABLE - search for term in any of TABLE's fields
+Usage: grep [options] arg
+
+Options:
+ -h, --help show this help message and exit
+ -i, --ignore-case Case-insensitive search
+
+testschema@eqtest> grep -i EM play
+play
+
+TITLE AUTHOR
+----------- -----------
+The Tempest Shakespeare
+Agamemnon Aeschylus
+
+2 rows selected.
\ No newline at end of file
diff -r 87eb1c6ed59b -r 3ce72ea76768 sqlpython/sqlpyPlus.py
--- a/sqlpython/sqlpyPlus.py Tue Oct 28 16:12:58 2008 -0400
+++ b/sqlpython/sqlpyPlus.py Tue Oct 28 16:44:51 2008 -0400
@@ -849,6 +849,8 @@
assignmentScanner = Parser(pyparsing.Literal(':=') ^ '=')
def do_setbind(self, arg):
+ if not arg:
+ return self.do_print(arg)
arg = self.parsed(arg).unterminated
try:
assigner, startat, endat = self.assignmentScanner.scanner.scanString(arg).next()