Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d2dc4ee

Browse files
committedAug 20, 2024
Doc improvements.
1 parent e6ae97f commit d2dc4ee

File tree

4 files changed

+86
-46
lines changed

4 files changed

+86
-46
lines changed
 

‎doc/src/api_manual/async_connection.rst

Lines changed: 69 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,21 @@ AsyncConnection Methods
4040
The exit point for the asynchronous connection as a context manager. This
4141
will close the connection and roll back any uncommitted transaction.
4242

43-
.. method:: AsyncConnection.callfunc(name, return_type, parameters=[], \
44-
keyword_parameters={})
43+
.. method:: AsyncConnection.callfunc(name, return_type, parameters=None, \
44+
keyword_parameters=None)
4545

4646
Calls a PL/SQL function with the given name.
4747

48-
This is a shortcut for creating a cursor, calling the stored function with
49-
the cursor, and then closing the cursor.
48+
This is a shortcut for calling :meth:`AsyncConnection.cursor()`,
49+
:meth:`AsyncCursor.callfunc()`, and then :meth:`AsyncCursor.close()`.
5050

51-
.. method:: AsyncConnection.callproc(name, parameters=[], \
52-
keyword_parameters={})
51+
.. method:: AsyncConnection.callproc(name, parameters=None, \
52+
keyword_parameters=None)
5353

5454
Calls a PL/SQL procedure with the given name.
5555

56-
This is a shortcut for creating a cursor, calling the stored procedure
57-
with the cursor, and then closing the cursor.
56+
This is a shortcut for calling :meth:`AsyncConnection.cursor()`,
57+
:meth:`AsyncCursor.callproc()`, and then :meth:`AsyncCursor.close()`.
5858

5959
.. method:: AsyncConnection.cancel()
6060

@@ -78,59 +78,94 @@ AsyncConnection Methods
7878

7979
.. method:: AsyncConnection.cursor(scrollable=False)
8080

81-
A synchronous method that returns a cursor associated with the connection.
81+
A synchronous method that returns an :ref:`AsyncCursor object
82+
<asynccursorobj>` associated with the connection.
8283

8384
.. method:: AsyncConnection.decode_oson(data)
8485

85-
A synchronous method that decodes OSON-encoded bytes and returns the object
86-
encoded in those bytes. This is useful for fetching columns which have the
87-
check constraint ``IS JSON FORMAT OSON`` enabled.
86+
A synchronous method that decodes `OSON-encoded
87+
<https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-911D302C-CFAF-406B-B6A5-4E99DD38ABAD>`__
88+
bytes and returns the object encoded in those bytes. This is useful for
89+
fetching columns which have the check constraint ``IS JSON FORMAT OSON``
90+
enabled.
8891

8992
.. versionadded:: 2.1.0
9093

9194
.. method:: AsyncConnection.encode_oson(value)
9295

93-
A synchronous method that encodes a Python value into OSON-encoded bytes
94-
and returns them. This is useful for inserting into columns which have the
95-
check constraint ``IS JSON FORMAT OSON`` enabled.
96+
A synchronous method that encodes a Python value into `OSON-encoded
97+
<https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-911D302C-CFAF-406B-B6A5-4E99DD38ABAD>`__
98+
bytes and returns them. This is useful for inserting into columns which
99+
have the check constraint ``IS JSON FORMAT OSON`` enabled.
96100

97101
.. versionadded:: 2.1.0
98102

99-
.. method:: AsyncConnection.execute(statement, parameters=[])
103+
.. method:: AsyncConnection.execute(statement, parameters=None)
100104

101105
Executes a statement against the database.
102106

103-
This is a shortcut for creating a cursor, executing a statement with the
104-
cursor, and then closing the cursor.
107+
This is a shortcut for calling :meth:`AsyncConnection.cursor()`,
108+
:meth:`AsyncCursor.execute()`, and then :meth:`AsyncCursor.close()`
105109

106-
.. method:: AsyncConnection.executemany(statement, parameters=[])
110+
.. method:: AsyncConnection.executemany(statement, parameters)
107111

108-
Prepares a statement for execution against a database and then executes it
109-
against all parameter mappings or sequences found in the sequence
110-
parameters.
112+
Executes a statement against all parameter mappings or sequences found in
113+
the sequence parameters.
111114

112-
This is a shortcut for creating a cursor, calling
113-
:meth:`AsyncCursor.executemany()` on the cursor, and then closing the
114-
cursor.
115+
If there are no parameters, the number of iterations can be specified as an
116+
integer instead of needing to provide a list of empty mappings or
117+
sequences.
118+
119+
This is a shortcut for calling :meth:`AsyncConnection.cursor()`,
120+
:meth:`AsyncCursor.executemany()`, and then :meth:`AsyncCursor.close()`.
115121

116122
.. method:: AsyncConnection.fetchall(statement, parameters=None, \
117123
arraysize=None, rowfactory=None)
118124

119-
Executes a query and returns all of the rows. After the rows are
120-
fetched, the cursor is closed.
125+
Executes a query and returns all of the rows.
126+
127+
The default value for ``arraysize`` is :attr:`defaults.arraysize`.
128+
129+
Internally, this method's :attr:`Cursor.prefetchrows` size is set to the
130+
value of the explicit or default ``arraysize`` parameter value.
131+
132+
This is a shortcut for calling :meth:`AsyncConnection.cursor()`,
133+
:meth:`AsyncCursor.fetchall()`, and then :meth:`AsyncCursor.close()`.
121134

122135
.. method:: AsyncConnection.fetchmany(statement, parameters=None, \
123136
num_rows=None, rowfactory=None)
124137

125-
Executes a query and returns up to the specified number of rows. After the
126-
rows are fetched, the cursor is closed.
138+
Executes a query and returns up to the specified number of rows.
139+
140+
The default value for ``num_rows`` is the value of
141+
:attr:`defaults.arraysize`.
142+
143+
Internally, this method's :attr:`Cursor.prefetchrows` size is set to the
144+
value of the explicit or default ``num_rows`` parameter, allowing all rows
145+
to be fetched in one :ref:`round-trip <roundtrips>`
146+
147+
Since only one fetch is performed for a query, consider adding a ``FETCH
148+
NEXT`` clause to the statement to prevent the database processing rows that
149+
will never be fetched, see :ref:`rowlimit`.
150+
151+
This a shortcut for calling :meth:`AsyncConnection.cursor()`,
152+
:meth:`AsyncCursor.fetchmany()`, and then :meth:`AsyncCursor.close()`.
127153

128154
.. method:: AsyncConnection.fetchone(statement, parameters=None, \
129155
rowfactory=None)
130156

131157
Executes a query and returns the first row of the result set if one exists
132-
(or None if no rows exist). After the row is fetched, the cursor is
133-
closed.
158+
(or None if no rows exist).
159+
160+
Internally, this method's :attr:`Cursor.prefetchrows` and
161+
:attr:`Cursor.arraysize` sizes will be set to 1.
162+
163+
Since only one fetch is performed for a query, consider adding a ``WHERE``
164+
condition or using a ``FETCH NEXT`` clause in the statement to prevent the
165+
database processing rows that will never be fetched, see :ref:`rowlimit`.
166+
167+
This a shortcut for calling :meth:`AsyncConnection.cursor()`,
168+
:meth:`AsyncCursor.fetchone()`, and then :meth:`AsyncCursor.close()`.
134169

135170
.. method:: AsyncConnection.gettype(name)
136171

@@ -145,7 +180,7 @@ AsyncConnection Methods
145180

146181
Connections may become unusable in several cases, such as, if the network
147182
socket is broken, if an Oracle error indicates the connection is unusable,
148-
or, after receiving a planned down notification from the database.
183+
or after receiving a planned down notification from the database.
149184

150185
This function is best used before starting a new database request on an
151186
existing standalone connection. Pooled connections internally perform this
@@ -155,8 +190,8 @@ AsyncConnection Methods
155190
application and a new connection should be established instead.
156191

157192
This function performs a local check. To fully check a connection's health,
158-
use :meth:`AsyncConnection.ping()` which performs a round-trip to the
159-
database.
193+
use :meth:`AsyncConnection.ping()` which performs a :ref:`round-trip
194+
<roundtrips>` to the database.
160195

161196
.. method:: AsyncConnection.ping()
162197

‎doc/src/api_manual/async_cursor.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ AsyncCursor Methods
5555
A synchronous method that returns the list of bind variable names bound to
5656
the statement. Note that a statement must have been prepared first.
5757

58-
.. method:: AsyncCursor.callfunc(name, returnType, parameters=[], \
59-
keyword_parameters={})
58+
.. method:: AsyncCursor.callfunc(name, returnType, parameters=None, \
59+
keyword_parameters=None)
6060

6161
Calls a function with the given name. The return type is specified in the
6262
same notation as is required by :meth:`~AsyncCursor.setinputsizes()`. The
@@ -73,7 +73,7 @@ AsyncCursor Methods
7373
prior to making this call, then note that the first item in the
7474
parameter list refers to the return value of the function.
7575

76-
.. method:: AsyncCursor.callproc(name, parameters=[], keyword_parameters={})
76+
.. method:: AsyncCursor.callproc(name, parameters=None, keyword_parameters=None)
7777

7878
Calls a procedure with the given name. The sequence of parameters must
7979
contain one entry for each parameter that the procedure expects. The result
@@ -91,7 +91,7 @@ AsyncCursor Methods
9191
forward; an Error exception will be raised if any operation is attempted
9292
with the cursor.
9393

94-
.. method:: AsyncCursor.execute(statement, parameters=[], ** keyword_parameters)
94+
.. method:: AsyncCursor.execute(statement, parameters=None, ** keyword_parameters)
9595

9696
Executes a statement against the database. See :ref:`sqlexecution`.
9797

‎doc/src/api_manual/connection.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,20 @@ Connection Methods
112112

113113
.. method:: Connection.decode_oson(data)
114114

115-
Decodes OSON-encoded bytes and returns the object encoded in those bytes.
116-
This is useful for fetching columns which have the check constraint
117-
``IS JSON FORMAT OSON`` enabled.
115+
Decodes `OSON-encoded
116+
<https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-911D302C-CFAF-406B-B6A5-4E99DD38ABAD>`__
117+
bytes and returns the object encoded in those bytes. This is useful for
118+
fetching columns which have the check constraint ``IS JSON FORMAT OSON``
119+
enabled.
118120

119121
.. versionadded:: 2.1.0
120122

121123
.. method:: Connection.encode_oson(value)
122124

123-
Encodes a Python value into OSON-encoded bytes and returns them. This is
124-
useful for inserting into columns which have the check constraint
125-
``IS JSON FORMAT OSON`` enabled.
125+
Encodes a Python value into `OSON-encoded
126+
<https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-911D302C-CFAF-406B-B6A5-4E99DD38ABAD>`__
127+
bytes and returns them. This is useful for inserting into columns which
128+
have the check constraint ``IS JSON FORMAT OSON`` enabled.
126129

127130
.. versionadded:: 2.1.0
128131

‎doc/src/api_manual/fetch_info.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ FetchInfo Attributes
7474
.. attribute:: FetchInfo.is_oson
7575

7676
This read-only attribute returns whether the column is known to contain
77-
binary encoded OSON data. This will be ``True`` when an "IS JSON FORMAT
78-
OSON" check constraint is enabled on BLOB columns.
77+
binary encoded `OSON
78+
<https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-911D302C-CFAF-406B-B6A5-4E99DD38ABAD>`__
79+
data. This will be ``True`` when an "IS JSON FORMAT OSON" check constraint
80+
is enabled on BLOB columns.
7981

8082
.. versionadded:: 2.1.0
8183

0 commit comments

Comments
 (0)
Please sign in to comment.