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

Function API_ROUTINE isc_dsql_prepare

src/yvalve/why.cpp:2664–2709  ·  view source on GitHub ↗

Prepare a statement for execution.

Source from the content-addressed store, hash-verified

2662
2663// Prepare a statement for execution.
2664ISC_STATUS API_ROUTINE isc_dsql_prepare(ISC_STATUS* userStatus, isc_tr_handle* traHandle,
2665 isc_stmt_handle* stmtHandle, USHORT stmtLength, const SCHAR* sqlStmt, USHORT dialect,
2666 XSQLDA* sqlda)
2667{
2668 StatusVector status(userStatus);
2669 CheckStatusWrapper statusWrapper(&status);
2670
2671 try
2672 {
2673 RefPtr<IscStatement> statement(translateHandle(statements, stmtHandle));
2674 RefPtr<YTransaction> transaction;
2675
2676 if (statement->statement)
2677 {
2678 statement->closeStatement(&statusWrapper);
2679 if (status.getState() & IStatus::STATE_ERRORS)
2680 return status[1];
2681 }
2682
2683 statement->cursorName = "";
2684
2685 if (traHandle && *traHandle)
2686 transaction = translateHandle(transactions, traHandle);
2687
2688 statement->statement = statement->attachment.get()->prepare(&statusWrapper, transaction,
2689 stmtLength, sqlStmt, dialect, IStatement::PREPARE_PREFETCH_METADATA);
2690
2691 if (!(status.getState() & IStatus::STATE_ERRORS))
2692 {
2693 StatusVector tempStatus(NULL);
2694 CheckStatusWrapper tempCheckStatusWrapper(&tempStatus);
2695
2696 RefPtr<IMessageMetadata> parameters(REF_NO_INCR,
2697 statement->statement->next->getOutputMetadata(&tempCheckStatusWrapper));
2698 tempStatus.check();
2699
2700 sqldaDescribeParameters(sqlda, parameters);
2701 }
2702 }
2703 catch (const Exception& e)
2704 {
2705 e.stuffException(&statusWrapper);
2706 }
2707
2708 return status[1];
2709}
2710
2711
2712// Prepare a statement for execution.

Callers

nothing calls this directly

Calls 9

translateHandleFunction · 0.85
sqldaDescribeParametersFunction · 0.85
closeStatementMethod · 0.80
getStateMethod · 0.45
prepareMethod · 0.45
getMethod · 0.45
getOutputMetadataMethod · 0.45
checkMethod · 0.45
stuffExceptionMethod · 0.45

Tested by

no test coverage detected