Skip to content

Commit d49a907

Browse files
author
James William Pye
committed
s/PreparedStatement/Statement
Leave 'PreparedStatement' names pointing to 'Statement' in .driver.pq3 and .api.
1 parent 081bd6c commit d49a907

23 files changed

Lines changed: 68 additions & 65 deletions

postgresql/api.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
__all__ = [
2222
'Message',
23-
'PreparedStatement',
23+
'Statement',
2424
'Chunks',
2525
'Rows',
2626
'Cursor',
@@ -193,7 +193,7 @@ def parameters(self) -> (tuple, None):
193193

194194
@propertydoc
195195
@abstractproperty
196-
def statement(self) -> ("PreparedStatement", None):
196+
def statement(self) -> ("Statement", None):
197197
"""
198198
The query object used to create the cursor. `None`, if unknown.
199199
@@ -218,7 +218,7 @@ class Cursor(
218218
set. Cursors publish a file-like interface for reading tuples from a cursor
219219
declared on the database.
220220
221-
`Cursor` objects are created by invoking the `PreparedStatement.declare`
221+
`Cursor` objects are created by invoking the `Statement.declare`
222222
method or by opening a cursor using an identifier via the
223223
`Database.cursor_from_id` method.
224224
"""
@@ -299,18 +299,19 @@ def seek(self, offset, whence = 'ABSOLUTE'):
299299
FROM_END will effectively be ABSOLUTE.
300300
"""
301301

302-
class PreparedStatement(
302+
class Statement(
303303
Element,
304304
collections.Callable,
305305
collections.Iterable,
306306
):
307307
"""
308-
Instances of `PreparedStatement` are returned by the `prepare` method of
308+
Instances of `Statement` are returned by the `prepare` method of
309309
`Database` instances.
310310
311-
A PreparedStatement is an Iterable as well as Callable. This feature is
312-
supported for queries that have the default arguments filled in or take no
313-
arguments at all. It allows for things like:
311+
A Statement is an Iterable as well as Callable.
312+
313+
The Iterable interface is supported for queries that take no arguments at
314+
all. It allows the syntax::
314315
315316
>>> for x in db.prepare('select * FROM table'):
316317
... pass
@@ -415,7 +416,7 @@ def parameter_types(self) -> [type]:
415416
"""
416417

417418
@abstractmethod
418-
def clone(self) -> "PreparedStatement":
419+
def clone(self) -> "Statement":
419420
"""
420421
Create a new statement object using the same factors as `self`.
421422
@@ -561,6 +562,7 @@ def close(self) -> None:
561562
"""
562563
Close the prepared statement releasing resources associated with it.
563564
"""
565+
PreparedStatement = Statement
564566

565567
class StoredProcedure(
566568
Element,
@@ -882,9 +884,9 @@ def execute(sql) -> None:
882884
"""
883885

884886
@abstractmethod
885-
def prepare(self, sql : str) -> PreparedStatement:
887+
def prepare(self, sql : str) -> Statement:
886888
"""
887-
Create a new `PreparedStatement` instance bound to the connection
889+
Create a new `Statement` instance bound to the connection
888890
using the given SQL.
889891
890892
>>> s = db.prepare("SELECT 1")
@@ -896,9 +898,9 @@ def prepare(self, sql : str) -> PreparedStatement:
896898
@abstractmethod
897899
def statement_from_id(self,
898900
statement_id : "The statement's identification string.",
899-
) -> PreparedStatement:
901+
) -> Statement:
900902
"""
901-
Create a `PreparedStatement` object that was already prepared on the
903+
Create a `Statement` object that was already prepared on the
902904
server. The distinction between this and a regular query is that it
903905
must be explicitly closed if it is no longer desired, and it is
904906
instantiated using the statement identifier as opposed to the SQL
@@ -916,7 +918,7 @@ def cursor_from_id(self,
916918
`Cursor` objects created this way must *not* be closed when the object
917919
is garbage collected. Rather, the user must explicitly close it for
918920
the server resources to be released. This is in contrast to `Cursor`
919-
objects that are created by invoking a `PreparedStatement` or a SRF
921+
objects that are created by invoking a `Statement` or a SRF
920922
`StoredProcedure`.
921923
"""
922924

postgresql/documentation/driver.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ interface elements:
3333
`postgresql.api.Connection`, a database connection. `Connections`_
3434

3535
``ps``
36-
`postgresql.api.PreparedStatement`, a prepared statement. `Prepared Statements`_
36+
`postgresql.api.Statement`, a prepared statement. `Prepared Statements`_
3737

3838
``c``
3939
`postgresql.api.Cursor`, a cursor; the results of a prepared statement.
@@ -317,7 +317,7 @@ After a connection is established::
317317
The methods and properties on the connection object are ready for use:
318318

319319
``Connection.prepare(sql_statement_string)``
320-
Create a `postgresql.api.PreparedStatement` object for querying the database.
320+
Create a `postgresql.api.Statement` object for querying the database.
321321
This provides an "SQL statement template" that can be executed multiple times.
322322
See `Prepared Statements`_ for more information.
323323

@@ -328,7 +328,7 @@ The methods and properties on the connection object are ready for use:
328328
`Stored Procedures`_ for more information.
329329

330330
``Connection.statement_from_id(statement_id)``
331-
Create a `postgresql.api.PreparedStatement` object from an existing statement
331+
Create a `postgresql.api.Statement` object from an existing statement
332332
identifier. This is used in cases where the statement was prepared on the
333333
server. See `Prepared Statements`_ for more information.
334334

@@ -460,7 +460,7 @@ be sent to the database at some point in the future. A statement is a single
460460
SQL command.
461461

462462
The ``prepare`` entry point on the connection provides the standard method for
463-
creating a `postgersql.api.PreparedStatement` instance bound to the
463+
creating a `postgersql.api.Statement` instance bound to the
464464
connection(``db``) from an SQL statement string::
465465

466466
>>> ps = db.prepare("SELECT 1")
@@ -821,7 +821,7 @@ iterator is the *fastest* way to move data::
821821
<lots of data>
822822

823823
``COPY FROM STDIN`` commands are supported via
824-
`postgresql.api.PreparedStatement.load_rows`. Each invocation to
824+
`postgresql.api.Statement.load_rows`. Each invocation to
825825
``load_rows`` is a single invocation of COPY. ``load_rows`` takes an iterable of
826826
COPY lines to send to the server::
827827

@@ -1651,7 +1651,7 @@ as follows::
16511651
Where ``Output`` can be a `postgresql.api.Cursor` object produced by
16521652
``declare(...)`` or an implicit output management object used *internally* by
16531653
``Statement.__call__()`` and other statement execution methods. Setting the
1654-
``msghook`` attribute on `postgresql.api.PreparedStatement` gives very fine
1654+
``msghook`` attribute on `postgresql.api.Statement` gives very fine
16551655
control over raised messages. Consider filtering the notice message on create
16561656
table statements that implicitly create indexes::
16571657

@@ -1675,7 +1675,7 @@ table statements that implicitly create indexes::
16751675
The above illustrates the quality of an installed ``msghook`` that simply
16761676
inhibits further propagation of messages with a severity of 'NOTICE'--but, only
16771677
notices coming from objects derived from the ``ct_this``
1678-
`postgresql.api.PreparedStatement` object.
1678+
`postgresql.api.Statement` object.
16791679

16801680
Subsequently, if the filter is installed on the connection's ``msghook``::
16811681

postgresql/documentation/html/_sources/copyman.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ of the Receivers.
121121

122122
.. note::
123123
Faults are only raised by `postgresql.copyman.CopyManager.__next__`. The
124-
``run()`` method will always raise `postgresql.copyman.CopyFail`.
124+
``run()`` method will only raise `postgresql.copyman.CopyFail`.
125125

126126
Receiver Faults
127127
---------------
@@ -300,8 +300,8 @@ processes of the `postgresql.copyman` module:
300300
An object that consumes COPY data. A target.
301301

302302
Fault
303-
Specifically, the `postgresql.copyman.Fault` exception. A Fault is raised
304-
when a Receiver raises an exception.
303+
Specifically, `postgresql.copyman.Fault` exceptions. A Fault is raised
304+
when a Receiver or a Producer raises an exception during the COPY operation.
305305

306306
Reconciliation
307307
Generally, the steps performed by the "reconcile" method on
@@ -316,6 +316,6 @@ processes of the `postgresql.copyman` module:
316316
exhaustion.
317317

318318
Realignment
319-
The process of providing compensating data to the receivers so that the
319+
The process of providing compensating data to the Receivers so that the
320320
connection will be on a message boundary. Occurs when the COPY operation
321-
fails.
321+
is aborted.

postgresql/documentation/html/_sources/driver.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ interface elements:
3333
`postgresql.api.Connection`, a database connection. `Connections`_
3434

3535
``ps``
36-
`postgresql.api.PreparedStatement`, a prepared statement. `Prepared Statements`_
36+
`postgresql.api.Statement`, a prepared statement. `Prepared Statements`_
3737

3838
``c``
3939
`postgresql.api.Cursor`, a cursor; the results of a prepared statement.
@@ -317,7 +317,7 @@ After a connection is established::
317317
The methods and properties on the connection object are ready for use:
318318

319319
``Connection.prepare(sql_statement_string)``
320-
Create a `postgresql.api.PreparedStatement` object for querying the database.
320+
Create a `postgresql.api.Statement` object for querying the database.
321321
This provides an "SQL statement template" that can be executed multiple times.
322322
See `Prepared Statements`_ for more information.
323323

@@ -328,7 +328,7 @@ The methods and properties on the connection object are ready for use:
328328
`Stored Procedures`_ for more information.
329329

330330
``Connection.statement_from_id(statement_id)``
331-
Create a `postgresql.api.PreparedStatement` object from an existing statement
331+
Create a `postgresql.api.Statement` object from an existing statement
332332
identifier. This is used in cases where the statement was prepared on the
333333
server. See `Prepared Statements`_ for more information.
334334

@@ -460,7 +460,7 @@ be sent to the database at some point in the future. A statement is a single
460460
SQL command.
461461

462462
The ``prepare`` entry point on the connection provides the standard method for
463-
creating a `postgersql.api.PreparedStatement` instance bound to the
463+
creating a `postgersql.api.Statement` instance bound to the
464464
connection(``db``) from an SQL statement string::
465465

466466
>>> ps = db.prepare("SELECT 1")
@@ -821,7 +821,7 @@ iterator is the *fastest* way to move data::
821821
<lots of data>
822822

823823
``COPY FROM STDIN`` commands are supported via
824-
`postgresql.api.PreparedStatement.load_rows`. Each invocation to
824+
`postgresql.api.Statement.load_rows`. Each invocation to
825825
``load_rows`` is a single invocation of COPY. ``load_rows`` takes an iterable of
826826
COPY lines to send to the server::
827827

@@ -1651,7 +1651,7 @@ as follows::
16511651
Where ``Output`` can be a `postgresql.api.Cursor` object produced by
16521652
``declare(...)`` or an implicit output management object used *internally* by
16531653
``Statement.__call__()`` and other statement execution methods. Setting the
1654-
``msghook`` attribute on `postgresql.api.PreparedStatement` gives very fine
1654+
``msghook`` attribute on `postgresql.api.Statement` gives very fine
16551655
control over raised messages. Consider filtering the notice message on create
16561656
table statements that implicitly create indexes::
16571657

@@ -1675,7 +1675,7 @@ table statements that implicitly create indexes::
16751675
The above illustrates the quality of an installed ``msghook`` that simply
16761676
inhibits further propagation of messages with a severity of 'NOTICE'--but, only
16771677
notices coming from objects derived from the ``ct_this``
1678-
`postgresql.api.PreparedStatement` object.
1678+
`postgresql.api.Statement` object.
16791679

16801680
Subsequently, if the filter is installed on the connection's ``msghook``::
16811681

postgresql/documentation/html/admin.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ <h3>Navigation</h3>
143143
</div>
144144
<div class="footer">
145145
&copy; Copyright 2010, James William Pye &lt;[email protected]&gt;.
146-
Last updated on Mar 25, 2010.
146+
Last updated on Mar 27, 2010.
147147
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.3.
148148
</div>
149149
</body>

postgresql/documentation/html/alock.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ <h3>Navigation</h3>
209209
</div>
210210
<div class="footer">
211211
&copy; Copyright 2010, James William Pye &lt;[email protected]&gt;.
212-
Last updated on Mar 25, 2010.
212+
Last updated on Mar 27, 2010.
213213
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.3.
214214
</div>
215215
</body>

postgresql/documentation/html/bin.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ <h3>Navigation</h3>
316316
</div>
317317
<div class="footer">
318318
&copy; Copyright 2010, James William Pye &lt;[email protected]&gt;.
319-
Last updated on Mar 25, 2010.
319+
Last updated on Mar 27, 2010.
320320
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.3.
321321
</div>
322322
</body>

postgresql/documentation/html/changes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ <h3>Navigation</h3>
154154
</div>
155155
<div class="footer">
156156
&copy; Copyright 2010, James William Pye &lt;[email protected]&gt;.
157-
Last updated on Mar 25, 2010.
157+
Last updated on Mar 27, 2010.
158158
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.3.
159159
</div>
160160
</body>

postgresql/documentation/html/clientparameters.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ <h3>Navigation</h3>
415415
</div>
416416
<div class="footer">
417417
&copy; Copyright 2010, James William Pye &lt;[email protected]&gt;.
418-
Last updated on Mar 25, 2010.
418+
Last updated on Mar 27, 2010.
419419
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.3.
420420
</div>
421421
</body>

postgresql/documentation/html/copyman.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ <h2>Faults<a class="headerlink" href="#faults" title="Permalink to this headline
153153
<div class="admonition note">
154154
<p class="first admonition-title">Note</p>
155155
<p class="last">Faults are only raised by <cite>postgresql.copyman.CopyManager.__next__</cite>. The
156-
<tt class="docutils literal"><span class="pre">run()</span></tt> method will always raise <cite>postgresql.copyman.CopyFail</cite>.</p>
156+
<tt class="docutils literal"><span class="pre">run()</span></tt> method will only raise <cite>postgresql.copyman.CopyFail</cite>.</p>
157157
</div>
158158
<div class="section" id="receiver-faults">
159159
<h3>Receiver Faults<a class="headerlink" href="#receiver-faults" title="Permalink to this headline"></a></h3>
@@ -321,8 +321,8 @@ <h2>Terminology<a class="headerlink" href="#terminology" title="Permalink to thi
321321
<dt>Receiver</dt>
322322
<dd>An object that consumes COPY data. A target.</dd>
323323
<dt>Fault</dt>
324-
<dd>Specifically, the <cite>postgresql.copyman.Fault</cite> exception. A Fault is raised
325-
when a Receiver raises an exception.</dd>
324+
<dd>Specifically, <cite>postgresql.copyman.Fault</cite> exceptions. A Fault is raised
325+
when a Receiver or a Producer raises an exception during the COPY operation.</dd>
326326
<dt>Reconciliation</dt>
327327
<dd>Generally, the steps performed by the &#8220;reconcile&#8221; method on
328328
<cite>postgresql.copyman.CopyManager</cite> instances. More precisely, the
@@ -334,9 +334,9 @@ <h2>Terminology<a class="headerlink" href="#terminology" title="Permalink to thi
334334
noted as failed in cases where the Manager&#8217;s iterator is <em>not</em> ran until
335335
exhaustion.</dd>
336336
<dt>Realignment</dt>
337-
<dd>The process of providing compensating data to the receivers so that the
337+
<dd>The process of providing compensating data to the Receivers so that the
338338
connection will be on a message boundary. Occurs when the COPY operation
339-
fails.</dd>
339+
is aborted.</dd>
340340
</dl>
341341
</blockquote>
342342
</div>
@@ -423,7 +423,7 @@ <h3>Navigation</h3>
423423
</div>
424424
<div class="footer">
425425
&copy; Copyright 2010, James William Pye &lt;[email protected]&gt;.
426-
Last updated on Mar 25, 2010.
426+
Last updated on Mar 27, 2010.
427427
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.3.
428428
</div>
429429
</body>

0 commit comments

Comments
 (0)