MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / openCursor

Method openCursor

src/dsql/DsqlRequests.cpp:520–566  ·  view source on GitHub ↗

Open a dynamic SQL cursor.

Source from the content-addressed store, hash-verified

518
519// Open a dynamic SQL cursor.
520DsqlCursor* DsqlDmlRequest::openCursor(thread_db* tdbb, jrd_tra** traHandle,
521 IMessageMetadata* inMeta, const UCHAR* inMsg, IMessageMetadata* outMeta, ULONG flags)
522{
523 SET_TDBB(tdbb);
524
525 Jrd::ContextPoolHolder context(tdbb, &getPool());
526
527 if (dsqlStatement->getFlags() & DsqlStatement::FLAG_ORPHAN)
528 {
529 ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
530 Arg::Gds(isc_bad_req_handle));
531 }
532
533 // Validate transaction handle
534
535 if (!*traHandle)
536 {
537 ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) <<
538 Arg::Gds(isc_bad_trans_handle));
539 }
540
541 // Validate statement type
542
543 if (!dsqlStatement->isCursorBased())
544 Arg::Gds(isc_no_cursor).raise();
545
546 // Validate cursor or batch being not already open
547
548 if (req_cursor)
549 {
550 ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-502) <<
551 Arg::Gds(isc_dsql_cursor_open_err));
552 }
553
554 if (req_batch)
555 {
556 ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-502) <<
557 Arg::Gds(isc_batch_open));
558 }
559
560 req_transaction = *traHandle;
561 execute(tdbb, traHandle, inMeta, inMsg, outMeta, NULL, false);
562
563 req_cursor = FB_NEW_POOL(getPool()) DsqlCursor(this, flags);
564
565 return req_cursor;
566}
567
568bool DsqlDmlRequest::needRestarts()
569{

Callers

nothing calls this directly

Calls 9

SET_TDBBFunction · 0.85
ERRD_postFunction · 0.85
GdsClass · 0.85
NumClass · 0.85
executeFunction · 0.85
isCursorBasedMethod · 0.80
DsqlCursorClass · 0.70
getFlagsMethod · 0.45
raiseMethod · 0.45

Tested by

no test coverage detected