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

Function API_ROUTINE isc_dsql_prepare_m

src/yvalve/why.cpp:2713–2759  ·  view source on GitHub ↗

Prepare a statement for execution.

Source from the content-addressed store, hash-verified

2711
2712// Prepare a statement for execution.
2713ISC_STATUS API_ROUTINE isc_dsql_prepare_m(ISC_STATUS* userStatus, isc_tr_handle* traHandle,
2714 isc_stmt_handle* stmtHandle, USHORT stmtLength, const SCHAR* sqlStmt, USHORT dialect,
2715 USHORT itemLength, const SCHAR* items, USHORT bufferLength, SCHAR* buffer)
2716{
2717 StatusVector status(userStatus);
2718 CheckStatusWrapper statusWrapper(&status);
2719
2720 try
2721 {
2722 RefPtr<IscStatement> statement(translateHandle(statements, stmtHandle));
2723 RefPtr<YTransaction> transaction;
2724
2725 if (statement->statement)
2726 {
2727 statement->closeStatement(&statusWrapper);
2728 if (status.getState() & IStatus::STATE_ERRORS)
2729 return status[1];
2730 }
2731
2732 statement->cursorName = "";
2733
2734 if (traHandle && *traHandle)
2735 transaction = translateHandle(transactions, traHandle);
2736
2737 unsigned flags = StatementMetadata::buildInfoFlags(
2738 itemLength, reinterpret_cast<const UCHAR*>(items));
2739
2740 statement->statement = statement->attachment.get()->prepare(&statusWrapper, transaction,
2741 stmtLength, sqlStmt, dialect, flags);
2742
2743 if (!(status.getState() & IStatus::STATE_ERRORS))
2744 {
2745 StatusVector tempStatus(NULL);
2746 CheckStatusWrapper tempCheckStatusWrapper(&tempStatus);
2747 statement->statement->getInfo(&tempCheckStatusWrapper,
2748 itemLength, reinterpret_cast<const UCHAR*>(items),
2749 bufferLength, reinterpret_cast<UCHAR*>(buffer));
2750 tempStatus.check();
2751 }
2752 }
2753 catch (const Exception& e)
2754 {
2755 e.stuffException(&statusWrapper);
2756 }
2757
2758 return status[1];
2759}
2760
2761
2762// Set a cursor name for a dynamic request.

Callers

nothing calls this directly

Calls 8

translateHandleFunction · 0.85
closeStatementMethod · 0.80
getStateMethod · 0.45
prepareMethod · 0.45
getMethod · 0.45
getInfoMethod · 0.45
checkMethod · 0.45
stuffExceptionMethod · 0.45

Tested by

no test coverage detected