[Python-checkins] r72801 - in python/trunk/Doc: includes/sqlite3/text_factory.py library/sqlite3.rst
georg.brandl
python-checkins at python.org
Wed May 20 20:31:14 CEST 2009
Author: georg.brandl
Date: Wed May 20 20:31:14 2009
New Revision: 72801
Log:
#6055: refer to "sqlite3" consistently.
Modified:
python/trunk/Doc/includes/sqlite3/text_factory.py
python/trunk/Doc/library/sqlite3.rst
Modified: python/trunk/Doc/includes/sqlite3/text_factory.py
==============================================================================
--- python/trunk/Doc/includes/sqlite3/text_factory.py (original)
+++ python/trunk/Doc/includes/sqlite3/text_factory.py Wed May 20 20:31:14 2009
@@ -13,7 +13,7 @@
row = cur.fetchone()
assert row[0] == AUSTRIA
-# but we can make pysqlite always return bytestrings ...
+# but we can make sqlite3 always return bytestrings ...
con.text_factory = str
cur.execute("select ?", (AUSTRIA,))
row = cur.fetchone()
@@ -26,11 +26,12 @@
# here we implement one that will ignore Unicode characters that cannot be
# decoded from UTF-8
con.text_factory = lambda x: unicode(x, "utf-8", "ignore")
-cur.execute("select ?", ("this is latin1 and would normally create errors" + u"\xe4\xf6\xfc".encode("latin1"),))
+cur.execute("select ?", ("this is latin1 and would normally create errors" +
+ u"\xe4\xf6\xfc".encode("latin1"),))
row = cur.fetchone()
assert type(row[0]) == unicode
-# pysqlite offers a builtin optimized text_factory that will return bytestring
+# sqlite3 offers a builtin optimized text_factory that will return bytestring
# objects, if the data is in ASCII only, and otherwise return unicode objects
con.text_factory = sqlite3.OptimizedUnicode
cur.execute("select ?", (AUSTRIA,))
Modified: python/trunk/Doc/library/sqlite3.rst
==============================================================================
--- python/trunk/Doc/library/sqlite3.rst (original)
+++ python/trunk/Doc/library/sqlite3.rst Wed May 20 20:31:14 2009
@@ -15,7 +15,7 @@
application using SQLite and then port the code to a larger database such as
PostgreSQL or Oracle.
-pysqlite was written by Gerhard Häring and provides a SQL interface compliant
+sqlite3 was written by Gerhard Häring and provides a SQL interface compliant
with the DB-API 2.0 specification described by :pep:`249`.
To use the module, you must first create a :class:`Connection` object that
@@ -52,8 +52,9 @@
Instead, use the DB-API's parameter substitution. Put ``?`` as a placeholder
wherever you want to use a value, and then provide a tuple of values as the
-second argument to the cursor's :meth:`~Cursor.execute` method. (Other database modules
-may use a different placeholder, such as ``%s`` or ``:1``.) For example::
+second argument to the cursor's :meth:`~Cursor.execute` method. (Other database
+modules may use a different placeholder, such as ``%s`` or ``:1``.) For
+example::
# Never do this -- insecure!
symbol = 'IBM'
@@ -92,11 +93,12 @@
.. seealso::
http://www.pysqlite.org
- The pysqlite web page.
+ The pysqlite web page -- sqlite3 is developed externally under the name
+ "pysqlite".
http://www.sqlite.org
- The SQLite web page; the documentation describes the syntax and the available
- data types for the supported SQL dialect.
+ The SQLite web page; the documentation describes the syntax and the
+ available data types for the supported SQL dialect.
:pep:`249` - Database API Specification 2.0
PEP written by Marc-André Lemburg.
@@ -802,10 +804,10 @@
...``, ``VACUUM``, ``PRAGMA``, the :mod:`sqlite3` module will commit implicitly
before executing that command. There are two reasons for doing that. The first
is that some of these commands don't work within transactions. The other reason
-is that pysqlite needs to keep track of the transaction state (if a transaction
+is that sqlite3 needs to keep track of the transaction state (if a transaction
is active or not).
-You can control which kind of ``BEGIN`` statements pysqlite implicitly executes
+You can control which kind of ``BEGIN`` statements sqlite3 implicitly executes
(or none at all) via the *isolation_level* parameter to the :func:`connect`
call, or via the :attr:`isolation_level` property of connections.
@@ -817,8 +819,8 @@
-Using pysqlite efficiently
---------------------------
+Using :mod:`sqlite3` efficiently
+--------------------------------
Using shortcut methods
More information about the Python-checkins
mailing list