MCPcopy Create free account
hub / github.com/apache/cloudberry / dbms_sql_open_cursor

Function dbms_sql_open_cursor

gpcontrib/orafce/dbms_sql.c:197–223  ·  view source on GitHub ↗

* FUNCTION dbms_sql.open_cursor() RETURNS int */

Source from the content-addressed store, hash-verified

195 * FUNCTION dbms_sql.open_cursor() RETURNS int
196 */
197Datum
198dbms_sql_open_cursor(PG_FUNCTION_ARGS)
199{
200 int i;
201
202 (void) fcinfo;
203
204 /* find and initialize first free slot */
205 for (i = 0; i < MAX_CURSORS; i++)
206 {
207 if (!cursors[i].assigned)
208 {
209 open_cursor(&cursors[i], i);
210
211 PG_RETURN_INT32(i);
212 }
213 }
214
215 ereport(ERROR,
216 (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
217 errmsg("too many opened cursors"),
218 errdetail("There is not free slot for new dbms_sql's cursor."),
219 errhint("You should to close unused cursors")));
220
221 /* be msvc quiet */
222 return (Datum) 0;
223}
224
225static CursorData *
226get_cursor(FunctionCallInfo fcinfo, bool should_be_assigned)

Callers

nothing calls this directly

Calls 5

open_cursorFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50
errdetailFunction · 0.50
errhintFunction · 0.50

Tested by

no test coverage detected