# HG changeset patch
# User catherine@dellzilla
# Date 1236206669 18000
# Node ID f0f293d83337cd9337c1dea6f807f47342471ba6
# Parent b5d4a122354ae68ad7b7512e5f74d18e5260f0e6
begin docs
diff -r b5d4a122354a -r f0f293d83337 docs/source/capabilities.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/source/capabilities.rst Wed Mar 04 17:44:29 2009 -0500
@@ -0,0 +1,54 @@
+SQLPython's extra capabilities
+==============================
+
+For the most part, SQLPython simply duplicates SQL\*Plus's capabilites.
+
+UNIX-like commands
+==================
+
+ls
+ Lists objects from the data dictionaries. There are implied wildcards at the beginning and
+ end
+
+cat
+ Shorthand for "SELECT * FROM"
+
+PostgreSQL-like shortcuts
+=========================
+
+----- ------------------
+z y
+----- ------------------
+\\c connect
+\\d desc
+\\e edit
+\\g run
+\\h help
+\\i load
+\\o spool
+\\p list
+\\q quit
+\\w save
+\\db _dir_tablespaces
+\\dd comments
+\\dn _dir_schemas
+\\dt _dir_tables
+\\dv _dir_views
+\\di _dir_indexes
+\\? help psql
+----- ------------------
+
+Wild SQL
+========
+
+Wild SQL is a nonstandard SQL feature that must be enabled with `set wildsql on`. When it is
+enabled, column names in a SELECT statement do not need to be explicitly typed.
+
+* % or \* as wildcards::
+
+ SELECT d* FROM v$database;
+
+ SELECT
+
+Wild SQL can only be used in the primary column list of straightforward SELECT statements,
+not in subqueries, `UNION`ed queries, etc.
\ No newline at end of file
diff -r b5d4a122354a -r f0f293d83337 docs/source/index.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/source/index.rst Wed Mar 04 17:44:29 2009 -0500
@@ -0,0 +1,24 @@
+.. SQLPython documentation master file, created by sphinx-quickstart on Wed Mar 4 15:43:28 2009.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+Welcome to SQLPython's documentation!
+=====================================
+
+Contents:
+
+.. toctree::
+ :maxdepth: 2
+
+ intro
+ capabilities
+ limitations
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
diff -r b5d4a122354a -r f0f293d83337 docs/source/intro.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/source/intro.rst Wed Mar 04 17:44:29 2009 -0500
@@ -0,0 +1,14 @@
+Introduction
+============
+
+SQLPython is a command-line interface to Oracle databases. It is intended as an alternative to Oracle's
+SQL\*Plus. For the most part, it can be used the same way SQL\*Plus would be used; this documentation
+focuses on the places where SQLPython differs.
+
+SQLPython was created by `Luca Canali _` at CERN. Most new development
+has been done by `Catherine Devlin _`.
+
+SQLPython is based on the Python standard library's cmd module, and on an extension to it called cmd2.
+
+SQLPython is currently only compatible with Oracle databases. Expanding it to other RDBMS is a dream
+for "one fine day". Call it "SQLPython 3000".
\ No newline at end of file
diff -r b5d4a122354a -r f0f293d83337 docs/source/limitations.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/source/limitations.rst Wed Mar 04 17:44:29 2009 -0500
@@ -0,0 +1,30 @@
+===========
+Limitations
+===========
+
+Slow parsing
+------------
+
+After each line of text in a multi-line command is entered, SQLPython pauses to determine whether
+the command is finished yet. This pause is unnoticable at first, but gradually becomes noticable,
+then annoying, then crippling when very long commands are entered.
+
+This problem can be worked around by bracketing long, individual commands in REMARK BEGIN
+and REMARK END statements. When SQLPython finds a REMARK BEGIN, it stops parsing after each
+line and assumes that everything entered until REMARK END is a single statement.
+
+PL/SQL
+------
+
+SQLPython interprets short anonymous PL/SQL blocks correctly, as well as one-line PL/SQL
+commands preceded with `exec`. For longer blocks, however, it gets confused about where
+the statement begins and ends.
+
+To parse PL/SQL safely, enclose each free-standing PL/SQL block between a REMARK BEGIN and a
+REMARK END statement.
+
+Unsupported commands
+--------------------
+
+ * DBMS_OUTPUT.PUT_LINE
+
diff -r b5d4a122354a -r f0f293d83337 sqlpython/sqlpyPlus.py
--- a/sqlpython/sqlpyPlus.py Wed Mar 04 14:52:02 2009 -0500
+++ b/sqlpython/sqlpyPlus.py Wed Mar 04 17:44:29 2009 -0500
@@ -362,13 +362,13 @@
sqlpython.sqlpython.noSpecialParse.append('spool')
commentGrammars = pyparsing.Or([pyparsing.Literal('--') + pyparsing.restOfLine, pyparsing.cStyleComment])
commentGrammars = pyparsing.Or([Parser.comment_def, pyparsing.cStyleComment])
- defaultFileName = 'afiedt.buf'
+ default_file_name = 'afiedt.buf'
def __init__(self):
sqlpython.sqlpython.__init__(self)
self.binds = CaselessDict()
self.settable += 'autobind commit_on_exit maxfetch maxtselctrows timeout heading wildsql'.split()
+ self.settable.remove('case_insensitive')
self.settable.sort()
- # settables must be lowercase
self.stdoutBeforeSpool = sys.stdout
self.spoolFile = None
self.autobind = False
@@ -412,10 +412,10 @@
if not line.lower().strip().startswith('begin'):
return
statement = []
- next = self.pseudo_raw_input(self.continuationPrompt)
+ next = self.pseudo_raw_input(self.continuation_prompt)
while next.lower().split()[:2] != ['remark','end']:
statement.append(next)
- next = self.pseudo_raw_input(self.continuationPrompt)
+ next = self.pseudo_raw_input(self.continuation_prompt)
return self.onecmd('\n'.join(statement))
def onecmd_plus_hooks(self, line):
@@ -730,7 +730,7 @@
"""Displays source code."""
self._pull(arg, opts)
- supported_ddl_types = 'CLUSTER, CONTEXT, DATABASE LINK, DIRECTORY, FUNCTION, INDEX, JOB, LIBRARY, MATERIALIZED VIEW, PACKAGE, PACKAGE BODY, OPERATOR, PACKAGE, PROCEDURE, SEQUENCE, SYNONYM, TABLE, TRIGGER, VIEW, TYPE, TYPE BODY, XML SCHEMA'
+ supported_ddl_types = 'CLUSTER, CONTEXT, DATABASE LINK, DIRECTORY, FUNCTION, INDEX, JOB, LIBRARY, MATERIALIZED VIEW, PACKAGE, PACKAGE BODY, PACKAGE SPEC, OPERATOR, PACKAGE, PROCEDURE, SEQUENCE, SYNONYM, TABLE, TRIGGER, VIEW, TYPE, TYPE BODY, XML SCHEMA'
do_pull.__doc__ += '\n\nSupported DDL types: ' + supported_ddl_types
supported_ddl_types = supported_ddl_types.split(', ')
@@ -1072,7 +1072,7 @@
def anon_plsql(self, line1):
lines = [line1]
while True:
- line = self.pseudo_raw_input(self.continuationPrompt)
+ line = self.pseudo_raw_input(self.continuation_prompt)
if line == 'EOF':
return
if line.strip() == '/':
diff -r b5d4a122354a -r f0f293d83337 sqlpython/sqlpython.py
--- a/sqlpython/sqlpython.py Wed Mar 04 14:52:02 2009 -0500
+++ b/sqlpython/sqlpython.py Wed Mar 04 17:44:29 2009 -0500
@@ -92,7 +92,8 @@
def default(self, arg):
self.varsUsed = sqlpyPlus.findBinds(arg, self.binds, givenBindVars={})
- if arg.parsed.command.lower() in ('create',):
+ ending_args = arg.lower().split()[-2:]
+ if 'end' in ending_args:
command = '%s %s;'
else:
command = '%s %s'