MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / API_ROUTINE isc_embed_dsql_prepare

Function API_ROUTINE isc_embed_dsql_prepare

src/yvalve/user_dsql.cpp:522–630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

520
521
522ISC_STATUS API_ROUTINE isc_embed_dsql_prepare(ISC_STATUS* user_status,
523 FB_API_HANDLE* db_handle,
524 FB_API_HANDLE* trans_handle,
525 const SCHAR* stmt_name,
526 USHORT length,
527 const SCHAR* string,
528 USHORT dialect,
529 XSQLDA* sqlda)
530 {
531/**************************************
532 *
533 * i s c _ e m b e d _ d s q l _ p r e p a r e
534 *
535 **************************************
536 *
537 * Functional description
538 * Prepare a statement for execution.
539 *
540 **************************************/
541 ISC_STATUS s;
542 ISC_STATUS_ARRAY local_status;
543 dsql_stmt* statement;
544 FB_API_HANDLE stmt_handle;
545
546 init(db_handle);
547 set_global_private_status(user_status, local_status);
548
549 try {
550
551 dsql_name* name = lookup_name(stmt_name, statement_names);
552
553 if (name && name->name_stmt->stmt_db_handle == *db_handle)
554 {
555 // The statement name already exists for this database.
556 // Re-use its statement handle.
557
558 statement = name->name_stmt;
559 stmt_handle = statement->stmt_handle;
560 }
561 else
562 {
563 // This is a new statement name for this database.
564 // Allocate a statement handle for it.
565
566 if (name) {
567 isc_embed_dsql_release(user_status, stmt_name);
568 }
569 statement = NULL;
570 stmt_handle = 0;
571 s = isc_dsql_allocate_statement(user_status, db_handle, &stmt_handle);
572 if (s)
573 {
574 return s;
575 }
576 }
577
578 s = isc_dsql_prepare(user_status, trans_handle, &stmt_handle, length, string, dialect, sqlda);
579

Callers

nothing calls this directly

Calls 8

lookup_nameFunction · 0.85
error_postFunction · 0.85
GdsClass · 0.85
insert_nameFunction · 0.85
remove_nameFunction · 0.85
initFunction · 0.70
errorFunction · 0.70

Tested by

no test coverage detected