mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-07 21:00:33 +03:00
Using uppercase P when dealing with Psycopg - not the module.
This commit is contained in:
parent
5c732ac2a3
commit
9955b2f32f
|
@ -234,7 +234,7 @@ Program code can initiate an asynchronous query by passing an ``async=1`` flag
|
||||||
to the :meth:`cursor.execute` or :meth:`cursor.callproc` methods. A very
|
to the :meth:`cursor.execute` or :meth:`cursor.callproc` methods. A very
|
||||||
simple example, from the connection to the query::
|
simple example, from the connection to the query::
|
||||||
|
|
||||||
conn = psycopg.connect(database='test')
|
conn = psycopg2.connect(database='test')
|
||||||
curs = conn.cursor()
|
curs = conn.cursor()
|
||||||
curs.execute("SELECT * from test WHERE fielda > %s", (1971,), async=1)
|
curs.execute("SELECT * from test WHERE fielda > %s", (1971,), async=1)
|
||||||
|
|
||||||
|
@ -275,10 +275,10 @@ asynchronous queries:
|
||||||
A code snippet that shows how to use the cursor object in a :func:`select()`
|
A code snippet that shows how to use the cursor object in a :func:`select()`
|
||||||
call::
|
call::
|
||||||
|
|
||||||
import psycopg
|
import psycopg2
|
||||||
import select
|
import select
|
||||||
|
|
||||||
conn = psycopg.connect(database='test')
|
conn = psycopg2.connect(database='test')
|
||||||
curs = conn.cursor()
|
curs = conn.cursor()
|
||||||
curs.execute("SELECT * from test WHERE fielda > %s", (1971,), async=1)
|
curs.execute("SELECT * from test WHERE fielda > %s", (1971,), async=1)
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ The ``cursor`` class
|
||||||
a single row at a time. It may also be used in the implementation of
|
a single row at a time. It may also be used in the implementation of
|
||||||
:meth:`executemany()`.
|
:meth:`executemany()`.
|
||||||
|
|
||||||
.. todo:: copied from dbapi: better specify what psycopg does with
|
.. todo:: copied from dbapi: better specify what psycopg2 does with
|
||||||
arraysize
|
arraysize
|
||||||
|
|
||||||
.. attribute:: rowcount
|
.. attribute:: rowcount
|
||||||
|
|
|
@ -11,7 +11,7 @@ heavily multi-threaded applications that create and destroy lots of cursors and
|
||||||
make a conspicuous number of concurrent INSERTs or UPDATEs. The psycopg
|
make a conspicuous number of concurrent INSERTs or UPDATEs. The psycopg
|
||||||
distribution includes ZPsycopgDA, a Zope_ Database Adapter.
|
distribution includes ZPsycopgDA, a Zope_ Database Adapter.
|
||||||
|
|
||||||
Psycopg 2 is an almost complete rewrite of the psycopg 1.1.x branch. Psycopg 2
|
Psycopg 2 is an almost complete rewrite of the Psycopg 1.1.x branch. Psycopg 2
|
||||||
features complete libpq_ v3 protocol, `COPY TO/COPY FROM`__ and full object
|
features complete libpq_ v3 protocol, `COPY TO/COPY FROM`__ and full object
|
||||||
adaptation for all basic Python 2.3 types: strings (including unicode), ints,
|
adaptation for all basic Python 2.3 types: strings (including unicode), ints,
|
||||||
longs, floats, buffers (binary objects), booleans, `mx.DateTime`_ and builtin
|
longs, floats, buffers (binary objects), booleans, `mx.DateTime`_ and builtin
|
||||||
|
|
|
@ -6,7 +6,7 @@ Basic module usage
|
||||||
.. index::
|
.. index::
|
||||||
pair: Example; Usage
|
pair: Example; Usage
|
||||||
|
|
||||||
The basic psycopg usage is common to all the database adapters implementing
|
The basic Psycopg usage is common to all the database adapters implementing
|
||||||
the |DBAPI 2.0| protocol. Here is an interactive session showing some of the
|
the |DBAPI 2.0| protocol. Here is an interactive session showing some of the
|
||||||
basic commands::
|
basic commands::
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ basic commands::
|
||||||
# Execute a command: this creates a new table
|
# Execute a command: this creates a new table
|
||||||
>>> cur.execute("CREATE TABLE test (id serial PRIMARY KEY, num integer, data varchar);")
|
>>> cur.execute("CREATE TABLE test (id serial PRIMARY KEY, num integer, data varchar);")
|
||||||
|
|
||||||
# Pass data to fill a query placeholders and let psycopg perform
|
# Pass data to fill a query placeholders and let Psycopg perform
|
||||||
# the correct conversion (no more SQL injections!)
|
# the correct conversion (no more SQL injections!)
|
||||||
>>> cur.execute("INSERT INTO test (num, data) VALUES (%s, %s)",
|
>>> cur.execute("INSERT INTO test (num, data) VALUES (%s, %s)",
|
||||||
... (100, "abc'def"))
|
... (100, "abc'def"))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user