* FUNCTION dbms_sql.open_cursor() RETURNS int */
| 195 | * FUNCTION dbms_sql.open_cursor() RETURNS int |
| 196 | */ |
| 197 | Datum |
| 198 | dbms_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 | |
| 225 | static CursorData * |
| 226 | get_cursor(FunctionCallInfo fcinfo, bool should_be_assigned) |
nothing calls this directly
no test coverage detected