summaryrefslogtreecommitdiff
path: root/docs/source
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2009-04-07 19:28:02 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2009-04-07 19:28:02 +0200
commit55410fc4c2e8163f0e89d14652b267ea5765e30c (patch)
tree384a6c0c10e9e25e3b8839ad1897cd505044b6b4 /docs/source
parent534a433f796e7bfc52ceb0bd1bfddf07333f1d46 (diff)
downloadsqlparse-55410fc4c2e8163f0e89d14652b267ea5765e30c.tar.gz
First version of documentation.
Diffstat (limited to 'docs/source')
-rw-r--r--docs/source/analyzing.rst64
-rw-r--r--docs/source/api.rst28
-rw-r--r--docs/source/cmdline.rst8
-rw-r--r--docs/source/index.rst3
-rw-r--r--docs/source/ui.rst15
5 files changed, 106 insertions, 12 deletions
diff --git a/docs/source/analyzing.rst b/docs/source/analyzing.rst
new file mode 100644
index 0000000..07b1fe9
--- /dev/null
+++ b/docs/source/analyzing.rst
@@ -0,0 +1,64 @@
+.. _analyze:
+
+Analyzing the Parsed Statement
+==============================
+
+When the :meth:`~sqlparse.parse` function is called the returned value
+is a tree-ish representation of the analyzed statements. The returned
+objects can be used by applications to retrieve further information about
+the parsed SQL.
+
+
+Base Classes
+------------
+
+All returned objects inherit from these base classes.
+The :class:`~sqlparse.sql.Token` class represents a single token and
+:class:`~sqlparse.sql.TokenList` class is a group of tokens.
+The latter provides methods for inspecting it's child tokens.
+
+.. autoclass:: sqlparse.sql.Token
+ :members:
+
+.. autoclass:: sqlparse.sql.TokenList
+ :members:
+
+
+SQL Representing Classes
+------------------------
+
+The following classes represent distinct parts of a SQL statement.
+
+.. autoclass:: sqlparse.sql.Statement
+ :members:
+
+.. autoclass:: sqlparse.sql.Comment
+ :members:
+
+.. autoclass:: sqlparse.sql.Identifier
+ :members:
+
+.. autoclass:: sqlparse.sql.IdentifierList
+ :members:
+
+.. autoclass:: sqlparse.sql.Where
+ :members:
+
+.. autoclass:: sqlparse.sql.Case
+ :members:
+
+.. autoclass:: sqlparse.sql.Parenthesis
+ :members:
+
+.. autoclass:: sqlparse.sql.If
+ :members:
+
+.. autoclass:: sqlparse.sql.For
+ :members:
+
+.. autoclass:: sqlparse.sql.Assignment
+ :members:
+
+.. autoclass:: sqlparse.sql.Comparsion
+ :members:
+
diff --git a/docs/source/api.rst b/docs/source/api.rst
index 1de31c0..2531c9b 100644
--- a/docs/source/api.rst
+++ b/docs/source/api.rst
@@ -1,6 +1,9 @@
:mod:`sqlparse` -- Parse SQL statements
=======================================
+.. module:: sqlparse
+ :synopsis: Parse SQL statements.
+
The :mod:`sqlparse` module provides the following functions on module-level.
.. autofunction:: sqlparse.split
@@ -15,9 +18,28 @@ The :mod:`sqlparse` module provides the following functions on module-level.
Formatting of SQL Statements
----------------------------
+The :meth:`~sqlparse.format` function accepts the following keyword arguments.
+
+``keyword_case``
+ Changes how keywords are formatted. Allowed values are "upper", "lower"
+ and "capitalize".
+
+``identifier_case``
+ Changes how identifiers are formatted. Allowed values are "upper", "lower",
+ and "capitalize".
+
+``strip_comments``
+ If ``True`` comments are removed from the statements.
+
+``reindent``
+ If ``True`` the indentations of the statements are changed.
-.. _analyze:
+``indent_tabs``
+ If ``True`` tabs instead of spaces are used for indentation.
-Analyzing the Parsed Statement
-------------------------------
+``indent_width``
+ The width of the indentation, defaults to 2.
+``output_format``
+ If given the output is additionally formatted to be used as a variable
+ in a programming language. Allowed values are "python" and "php".
diff --git a/docs/source/cmdline.rst b/docs/source/cmdline.rst
deleted file mode 100644
index 93a35a7..0000000
--- a/docs/source/cmdline.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-``sqlformat`` -- Command Line Script
-===========================================
-
-The :mod:`sqlparse` module is shipped with the script
-:program:`sqlformat` which provides a command line interface to the formatting
-functions.
-
-.. todo:: Describe options and example usage.
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 0e74763..44d03a2 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -11,7 +11,8 @@ python-sqlparse's documentation contents
intro
api
- cmdline
+ analyzing
+ ui
changes
diff --git a/docs/source/ui.rst b/docs/source/ui.rst
new file mode 100644
index 0000000..264916e
--- /dev/null
+++ b/docs/source/ui.rst
@@ -0,0 +1,15 @@
+User Interfaces
+===============
+
+``sqlformat``
+ The ``sqlformat`` command line script ist distributed with the module.
+ Run :command:`sqlformat --help` to list available options and for usage
+ hints.
+
+``sqlformat.appspot.com``
+ An example `Google App Engine <http://code.google.com/appengine/>`_
+ application that exposes the formatting features using a web front-end.
+ See http://sqlformat.appspot.com for details.
+ The source for this application is available from a source code check out
+ of the :mod:`sqlparse` module (see :file:`extras/appengine`).
+