mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Fix sqlite3 class markup.
This commit is contained in:
parent
c820de5e60
commit
95d7cdfd7b
1 changed files with 213 additions and 213 deletions
|
@ -231,58 +231,58 @@ Connection Objects
|
||||||
|
|
||||||
A SQLite database connection has the following attributes and methods:
|
A SQLite database connection has the following attributes and methods:
|
||||||
|
|
||||||
.. attribute:: Connection.isolation_level
|
.. attribute:: isolation_level
|
||||||
|
|
||||||
Get or set the current isolation level. :const:`None` for autocommit mode or
|
Get or set the current isolation level. :const:`None` for autocommit mode or
|
||||||
one of "DEFERRED", "IMMEDIATE" or "EXCLUSIVE". See section
|
one of "DEFERRED", "IMMEDIATE" or "EXCLUSIVE". See section
|
||||||
:ref:`sqlite3-controlling-transactions` for a more detailed explanation.
|
:ref:`sqlite3-controlling-transactions` for a more detailed explanation.
|
||||||
|
|
||||||
|
|
||||||
.. method:: Connection.cursor([cursorClass])
|
.. method:: cursor([cursorClass])
|
||||||
|
|
||||||
The cursor method accepts a single optional parameter *cursorClass*. If
|
The cursor method accepts a single optional parameter *cursorClass*. If
|
||||||
supplied, this must be a custom cursor class that extends
|
supplied, this must be a custom cursor class that extends
|
||||||
:class:`sqlite3.Cursor`.
|
:class:`sqlite3.Cursor`.
|
||||||
|
|
||||||
.. method:: Connection.commit()
|
.. method:: commit()
|
||||||
|
|
||||||
This method commits the current transaction. If you don't call this method,
|
This method commits the current transaction. If you don't call this method,
|
||||||
anything you did since the last call to ``commit()`` is not visible from
|
anything you did since the last call to ``commit()`` is not visible from
|
||||||
other database connections. If you wonder why you don't see the data you've
|
other database connections. If you wonder why you don't see the data you've
|
||||||
written to the database, please check you didn't forget to call this method.
|
written to the database, please check you didn't forget to call this method.
|
||||||
|
|
||||||
.. method:: Connection.rollback()
|
.. method:: rollback()
|
||||||
|
|
||||||
This method rolls back any changes to the database since the last call to
|
This method rolls back any changes to the database since the last call to
|
||||||
:meth:`commit`.
|
:meth:`commit`.
|
||||||
|
|
||||||
.. method:: Connection.close()
|
.. method:: close()
|
||||||
|
|
||||||
This closes the database connection. Note that this does not automatically
|
This closes the database connection. Note that this does not automatically
|
||||||
call :meth:`commit`. If you just close your database connection without
|
call :meth:`commit`. If you just close your database connection without
|
||||||
calling :meth:`commit` first, your changes will be lost!
|
calling :meth:`commit` first, your changes will be lost!
|
||||||
|
|
||||||
.. method:: Connection.execute(sql, [parameters])
|
.. method:: execute(sql, [parameters])
|
||||||
|
|
||||||
This is a nonstandard shortcut that creates an intermediate cursor object by
|
This is a nonstandard shortcut that creates an intermediate cursor object by
|
||||||
calling the cursor method, then calls the cursor's :meth:`execute
|
calling the cursor method, then calls the cursor's :meth:`execute
|
||||||
<Cursor.execute>` method with the parameters given.
|
<Cursor.execute>` method with the parameters given.
|
||||||
|
|
||||||
|
|
||||||
.. method:: Connection.executemany(sql, [parameters])
|
.. method:: executemany(sql, [parameters])
|
||||||
|
|
||||||
This is a nonstandard shortcut that creates an intermediate cursor object by
|
This is a nonstandard shortcut that creates an intermediate cursor object by
|
||||||
calling the cursor method, then calls the cursor's :meth:`executemany
|
calling the cursor method, then calls the cursor's :meth:`executemany
|
||||||
<Cursor.executemany>` method with the parameters given.
|
<Cursor.executemany>` method with the parameters given.
|
||||||
|
|
||||||
.. method:: Connection.executescript(sql_script)
|
.. method:: executescript(sql_script)
|
||||||
|
|
||||||
This is a nonstandard shortcut that creates an intermediate cursor object by
|
This is a nonstandard shortcut that creates an intermediate cursor object by
|
||||||
calling the cursor method, then calls the cursor's :meth:`executescript
|
calling the cursor method, then calls the cursor's :meth:`executescript
|
||||||
<Cursor.executescript>` method with the parameters given.
|
<Cursor.executescript>` method with the parameters given.
|
||||||
|
|
||||||
|
|
||||||
.. method:: Connection.create_function(name, num_params, func)
|
.. method:: create_function(name, num_params, func)
|
||||||
|
|
||||||
Creates a user-defined function that you can later use from within SQL
|
Creates a user-defined function that you can later use from within SQL
|
||||||
statements under the function name *name*. *num_params* is the number of
|
statements under the function name *name*. *num_params* is the number of
|
||||||
|
@ -297,7 +297,7 @@ Connection Objects
|
||||||
.. literalinclude:: ../includes/sqlite3/md5func.py
|
.. literalinclude:: ../includes/sqlite3/md5func.py
|
||||||
|
|
||||||
|
|
||||||
.. method:: Connection.create_aggregate(name, num_params, aggregate_class)
|
.. method:: create_aggregate(name, num_params, aggregate_class)
|
||||||
|
|
||||||
Creates a user-defined aggregate function.
|
Creates a user-defined aggregate function.
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ Connection Objects
|
||||||
.. literalinclude:: ../includes/sqlite3/mysumaggr.py
|
.. literalinclude:: ../includes/sqlite3/mysumaggr.py
|
||||||
|
|
||||||
|
|
||||||
.. method:: Connection.create_collation(name, callable)
|
.. method:: create_collation(name, callable)
|
||||||
|
|
||||||
Creates a collation with the specified *name* and *callable*. The callable will
|
Creates a collation with the specified *name* and *callable*. The callable will
|
||||||
be passed two string arguments. It should return -1 if the first is ordered
|
be passed two string arguments. It should return -1 if the first is ordered
|
||||||
|
@ -333,14 +333,14 @@ Connection Objects
|
||||||
con.create_collation("reverse", None)
|
con.create_collation("reverse", None)
|
||||||
|
|
||||||
|
|
||||||
.. method:: Connection.interrupt()
|
.. method:: interrupt()
|
||||||
|
|
||||||
You can call this method from a different thread to abort any queries that might
|
You can call this method from a different thread to abort any queries that might
|
||||||
be executing on the connection. The query will then abort and the caller will
|
be executing on the connection. The query will then abort and the caller will
|
||||||
get an exception.
|
get an exception.
|
||||||
|
|
||||||
|
|
||||||
.. method:: Connection.set_authorizer(authorizer_callback)
|
.. method:: set_authorizer(authorizer_callback)
|
||||||
|
|
||||||
This routine registers a callback. The callback is invoked for each attempt to
|
This routine registers a callback. The callback is invoked for each attempt to
|
||||||
access a column of a table in the database. The callback should return
|
access a column of a table in the database. The callback should return
|
||||||
|
@ -361,7 +361,7 @@ Connection Objects
|
||||||
one. All necessary constants are available in the :mod:`sqlite3` module.
|
one. All necessary constants are available in the :mod:`sqlite3` module.
|
||||||
|
|
||||||
|
|
||||||
.. method:: Connection.set_progress_handler(handler, n)
|
.. method:: set_progress_handler(handler, n)
|
||||||
|
|
||||||
This routine registers a callback. The callback is invoked for every *n*
|
This routine registers a callback. The callback is invoked for every *n*
|
||||||
instructions of the SQLite virtual machine. This is useful if you want to
|
instructions of the SQLite virtual machine. This is useful if you want to
|
||||||
|
@ -374,7 +374,7 @@ Connection Objects
|
||||||
.. versionadded:: 2.6
|
.. versionadded:: 2.6
|
||||||
|
|
||||||
|
|
||||||
.. method:: Connection.enable_load_extension(enabled)
|
.. method:: enable_load_extension(enabled)
|
||||||
|
|
||||||
This routine allows/disallows the SQLite engine to load SQLite extensions
|
This routine allows/disallows the SQLite engine to load SQLite extensions
|
||||||
from shared libraries. SQLite extensions can define new functions,
|
from shared libraries. SQLite extensions can define new functions,
|
||||||
|
@ -387,7 +387,7 @@ Connection Objects
|
||||||
|
|
||||||
.. literalinclude:: ../includes/sqlite3/load_extension.py
|
.. literalinclude:: ../includes/sqlite3/load_extension.py
|
||||||
|
|
||||||
.. method:: Connection.load_extension(path)
|
.. method:: load_extension(path)
|
||||||
|
|
||||||
This routine loads a SQLite extension from a shared library. You have to
|
This routine loads a SQLite extension from a shared library. You have to
|
||||||
enable extension loading with :meth:`enable_load_extension` before you can
|
enable extension loading with :meth:`enable_load_extension` before you can
|
||||||
|
@ -397,7 +397,7 @@ Connection Objects
|
||||||
|
|
||||||
.. versionadded:: 2.7
|
.. versionadded:: 2.7
|
||||||
|
|
||||||
.. attribute:: Connection.row_factory
|
.. attribute:: row_factory
|
||||||
|
|
||||||
You can change this attribute to a callable that accepts the cursor and the
|
You can change this attribute to a callable that accepts the cursor and the
|
||||||
original row as a tuple and will return the real result row. This way, you can
|
original row as a tuple and will return the real result row. This way, you can
|
||||||
|
@ -418,7 +418,7 @@ Connection Objects
|
||||||
.. XXX what's a db_row-based solution?
|
.. XXX what's a db_row-based solution?
|
||||||
|
|
||||||
|
|
||||||
.. attribute:: Connection.text_factory
|
.. attribute:: text_factory
|
||||||
|
|
||||||
Using this attribute you can control what objects are returned for the ``TEXT``
|
Using this attribute you can control what objects are returned for the ``TEXT``
|
||||||
data type. By default, this attribute is set to :class:`unicode` and the
|
data type. By default, this attribute is set to :class:`unicode` and the
|
||||||
|
@ -437,13 +437,13 @@ Connection Objects
|
||||||
.. literalinclude:: ../includes/sqlite3/text_factory.py
|
.. literalinclude:: ../includes/sqlite3/text_factory.py
|
||||||
|
|
||||||
|
|
||||||
.. attribute:: Connection.total_changes
|
.. attribute:: total_changes
|
||||||
|
|
||||||
Returns the total number of database rows that have been modified, inserted, or
|
Returns the total number of database rows that have been modified, inserted, or
|
||||||
deleted since the database connection was opened.
|
deleted since the database connection was opened.
|
||||||
|
|
||||||
|
|
||||||
.. attribute:: Connection.iterdump
|
.. attribute:: iterdump
|
||||||
|
|
||||||
Returns an iterator to dump the database in an SQL text format. Useful when
|
Returns an iterator to dump the database in an SQL text format. Useful when
|
||||||
saving an in-memory database for later restoration. This function provides
|
saving an in-memory database for later restoration. This function provides
|
||||||
|
@ -472,7 +472,7 @@ Cursor Objects
|
||||||
|
|
||||||
A :class:`Cursor` instance has the following attributes and methods.
|
A :class:`Cursor` instance has the following attributes and methods.
|
||||||
|
|
||||||
.. method:: Cursor.execute(sql, [parameters])
|
.. method:: execute(sql, [parameters])
|
||||||
|
|
||||||
Executes an SQL statement. The SQL statement may be parameterized (i. e.
|
Executes an SQL statement. The SQL statement may be parameterized (i. e.
|
||||||
placeholders instead of SQL literals). The :mod:`sqlite3` module supports two
|
placeholders instead of SQL literals). The :mod:`sqlite3` module supports two
|
||||||
|
@ -489,7 +489,7 @@ Cursor Objects
|
||||||
call.
|
call.
|
||||||
|
|
||||||
|
|
||||||
.. method:: Cursor.executemany(sql, seq_of_parameters)
|
.. method:: executemany(sql, seq_of_parameters)
|
||||||
|
|
||||||
Executes an SQL command against all parameter sequences or mappings found in
|
Executes an SQL command against all parameter sequences or mappings found in
|
||||||
the sequence *sql*. The :mod:`sqlite3` module also allows using an
|
the sequence *sql*. The :mod:`sqlite3` module also allows using an
|
||||||
|
@ -502,7 +502,7 @@ Cursor Objects
|
||||||
.. literalinclude:: ../includes/sqlite3/executemany_2.py
|
.. literalinclude:: ../includes/sqlite3/executemany_2.py
|
||||||
|
|
||||||
|
|
||||||
.. method:: Cursor.executescript(sql_script)
|
.. method:: executescript(sql_script)
|
||||||
|
|
||||||
This is a nonstandard convenience method for executing multiple SQL statements
|
This is a nonstandard convenience method for executing multiple SQL statements
|
||||||
at once. It issues a ``COMMIT`` statement first, then executes the SQL script it
|
at once. It issues a ``COMMIT`` statement first, then executes the SQL script it
|
||||||
|
@ -515,13 +515,13 @@ Cursor Objects
|
||||||
.. literalinclude:: ../includes/sqlite3/executescript.py
|
.. literalinclude:: ../includes/sqlite3/executescript.py
|
||||||
|
|
||||||
|
|
||||||
.. method:: Cursor.fetchone()
|
.. method:: fetchone()
|
||||||
|
|
||||||
Fetches the next row of a query result set, returning a single sequence,
|
Fetches the next row of a query result set, returning a single sequence,
|
||||||
or :const:`None` when no more data is available.
|
or :const:`None` when no more data is available.
|
||||||
|
|
||||||
|
|
||||||
.. method:: Cursor.fetchmany([size=cursor.arraysize])
|
.. method:: fetchmany([size=cursor.arraysize])
|
||||||
|
|
||||||
Fetches the next set of rows of a query result, returning a list. An empty
|
Fetches the next set of rows of a query result, returning a list. An empty
|
||||||
list is returned when no more rows are available.
|
list is returned when no more rows are available.
|
||||||
|
@ -537,14 +537,14 @@ Cursor Objects
|
||||||
If the *size* parameter is used, then it is best for it to retain the same
|
If the *size* parameter is used, then it is best for it to retain the same
|
||||||
value from one :meth:`fetchmany` call to the next.
|
value from one :meth:`fetchmany` call to the next.
|
||||||
|
|
||||||
.. method:: Cursor.fetchall()
|
.. method:: fetchall()
|
||||||
|
|
||||||
Fetches all (remaining) rows of a query result, returning a list. Note that
|
Fetches all (remaining) rows of a query result, returning a list. Note that
|
||||||
the cursor's arraysize attribute can affect the performance of this operation.
|
the cursor's arraysize attribute can affect the performance of this operation.
|
||||||
An empty list is returned when no rows are available.
|
An empty list is returned when no rows are available.
|
||||||
|
|
||||||
|
|
||||||
.. attribute:: Cursor.rowcount
|
.. attribute:: rowcount
|
||||||
|
|
||||||
Although the :class:`Cursor` class of the :mod:`sqlite3` module implements this
|
Although the :class:`Cursor` class of the :mod:`sqlite3` module implements this
|
||||||
attribute, the database engine's own support for the determination of "rows
|
attribute, the database engine's own support for the determination of "rows
|
||||||
|
@ -562,14 +562,14 @@ Cursor Objects
|
||||||
With SQLite versions before 3.6.5, :attr:`rowcount` is set to 0 if
|
With SQLite versions before 3.6.5, :attr:`rowcount` is set to 0 if
|
||||||
you make a ``DELETE FROM table`` without any condition.
|
you make a ``DELETE FROM table`` without any condition.
|
||||||
|
|
||||||
.. attribute:: Cursor.lastrowid
|
.. attribute:: lastrowid
|
||||||
|
|
||||||
This read-only attribute provides the rowid of the last modified row. It is
|
This read-only attribute provides the rowid of the last modified row. It is
|
||||||
only set if you issued a ``INSERT`` statement using the :meth:`execute`
|
only set if you issued a ``INSERT`` statement using the :meth:`execute`
|
||||||
method. For operations other than ``INSERT`` or when :meth:`executemany` is
|
method. For operations other than ``INSERT`` or when :meth:`executemany` is
|
||||||
called, :attr:`lastrowid` is set to :const:`None`.
|
called, :attr:`lastrowid` is set to :const:`None`.
|
||||||
|
|
||||||
.. attribute:: Cursor.description
|
.. attribute:: description
|
||||||
|
|
||||||
This read-only attribute provides the column names of the last query. To
|
This read-only attribute provides the column names of the last query. To
|
||||||
remain compatible with the Python DB API, it returns a 7-tuple for each
|
remain compatible with the Python DB API, it returns a 7-tuple for each
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue