@@ -40,21 +40,21 @@ AsyncConnection Methods
40
40
The exit point for the asynchronous connection as a context manager. This
41
41
will close the connection and roll back any uncommitted transaction.
42
42
43
- .. method :: AsyncConnection.callfunc(name, return_type, parameters=[] , \
44
- keyword_parameters={} )
43
+ .. method :: AsyncConnection.callfunc(name, return_type, parameters=None , \
44
+ keyword_parameters=None )
45
45
46
46
Calls a PL/SQL function with the given name.
47
47
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() ` .
50
50
51
- .. method :: AsyncConnection.callproc(name, parameters=[] , \
52
- keyword_parameters={} )
51
+ .. method :: AsyncConnection.callproc(name, parameters=None , \
52
+ keyword_parameters=None )
53
53
54
54
Calls a PL/SQL procedure with the given name.
55
55
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() ` .
58
58
59
59
.. method :: AsyncConnection.cancel()
60
60
@@ -78,59 +78,94 @@ AsyncConnection Methods
78
78
79
79
.. method :: AsyncConnection.cursor(scrollable=False)
80
80
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.
82
83
83
84
.. method :: AsyncConnection.decode_oson(data)
84
85
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.
88
91
89
92
.. versionadded :: 2.1.0
90
93
91
94
.. method :: AsyncConnection.encode_oson(value)
92
95
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.
96
100
97
101
.. versionadded :: 2.1.0
98
102
99
- .. method :: AsyncConnection.execute(statement, parameters=[] )
103
+ .. method :: AsyncConnection.execute(statement, parameters=None )
100
104
101
105
Executes a statement against the database.
102
106
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() `
105
109
106
- .. method :: AsyncConnection.executemany(statement, parameters=[] )
110
+ .. method :: AsyncConnection.executemany(statement, parameters)
107
111
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.
111
114
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() `.
115
121
116
122
.. method :: AsyncConnection.fetchall(statement, parameters=None, \
117
123
arraysize=None, rowfactory=None)
118
124
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() `.
121
134
122
135
.. method :: AsyncConnection.fetchmany(statement, parameters=None, \
123
136
num_rows=None, rowfactory=None)
124
137
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() `.
127
153
128
154
.. method :: AsyncConnection.fetchone(statement, parameters=None, \
129
155
rowfactory=None)
130
156
131
157
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() `.
134
169
135
170
.. method :: AsyncConnection.gettype(name)
136
171
@@ -145,7 +180,7 @@ AsyncConnection Methods
145
180
146
181
Connections may become unusable in several cases, such as, if the network
147
182
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.
149
184
150
185
This function is best used before starting a new database request on an
151
186
existing standalone connection. Pooled connections internally perform this
@@ -155,8 +190,8 @@ AsyncConnection Methods
155
190
application and a new connection should be established instead.
156
191
157
192
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.
160
195
161
196
.. method :: AsyncConnection.ping()
162
197
0 commit comments