Skip to content

Commit 831a95f

Browse files
committed
Cross-link to bind parameters
1 parent f4baac5 commit 831a95f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

postgres/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
Jump ahead for the :ref:`orm-tutorial`.
5656
5757
58+
.. _bind-parameters:
59+
5860
Bind Parameters
5961
+++++++++++++++
6062
@@ -350,12 +352,14 @@ def run(self, sql, parameters=None, *a, **kw):
350352
"""Execute a query and discard any results.
351353
352354
:param string sql: the SQL statement to execute
353-
:param parameters: the bind parameters for the SQL statement
355+
:param parameters: the `bind parameters`_ for the SQL statement
354356
:type parameters: dict or tuple
355357
:param a: passed through to :py:meth:`~postgres.Postgres.get_cursor`
356358
:param kw: passed through to :py:meth:`~postgres.Postgres.get_cursor`
357359
:returns: :py:const:`None`
358360
361+
.. _bind parameters: #bind-parameters
362+
359363
>>> db.run("DROP TABLE IF EXISTS foo CASCADE")
360364
>>> db.run("CREATE TABLE foo (bar text, baz int)")
361365
>>> db.run("INSERT INTO foo VALUES ('buz', 42)")
@@ -370,7 +374,7 @@ def one(self, sql, parameters=None, back_as=None, default=None, *a, **kw):
370374
"""Execute a query and return a single result or a default value.
371375
372376
:param string sql: the SQL statement to execute
373-
:param parameters: the bind parameters for the SQL statement
377+
:param parameters: the `bind parameters`_ for the SQL statement
374378
:type parameters: dict or tuple
375379
:param back_as: the type of record to return
376380
:type back_as: type or string
@@ -383,6 +387,8 @@ def one(self, sql, parameters=None, back_as=None, default=None, *a, **kw):
383387
:py:attr:`default` argument
384388
:raises: :py:exc:`~postgres.TooFew` or :py:exc:`~postgres.TooMany`
385389
390+
.. _bind parameters: #bind-parameters
391+
386392
Use this for the common case where there should only be one record, but
387393
it may not exist yet.
388394
@@ -474,7 +480,7 @@ def all(self, sql, parameters=None, back_as=None, *a, **kw):
474480
"""Execute a query and return all results.
475481
476482
:param string sql: the SQL statement to execute
477-
:param parameters: the bind parameters for the SQL statement
483+
:param parameters: the `bind parameters`_ for the SQL statement
478484
:type parameters: dict or tuple
479485
:param back_as: the type of record to return
480486
:type back_as: type or string
@@ -485,6 +491,8 @@ def all(self, sql, parameters=None, back_as=None, *a, **kw):
485491
:returns: :py:class:`list` of records or :py:class:`list` of single
486492
values
487493
494+
.. _bind parameters: #bind-parameters
495+
488496
>>> db.all("SELECT * FROM foo ORDER BY bar")
489497
[Record(bar='bit', baz=537), Record(bar='buz', baz=42)]
490498

0 commit comments

Comments
 (0)