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

Function API_ROUTINE isc_dsql_execute2

src/yvalve/why.cpp:2278–2329  ·  view source on GitHub ↗

Execute a non-SELECT dynamic SQL statement.

Source from the content-addressed store, hash-verified

2276
2277// Execute a non-SELECT dynamic SQL statement.
2278ISC_STATUS API_ROUTINE isc_dsql_execute2(ISC_STATUS* userStatus, isc_tr_handle* traHandle,
2279 isc_stmt_handle* stmtHandle, USHORT dialect, const XSQLDA* inSqlda, const XSQLDA* outSqlda)
2280{
2281 StatusVector status(userStatus);
2282 CheckStatusWrapper statusWrapper(&status);
2283
2284 try
2285 {
2286 RefPtr<IscStatement> statement(translateHandle(statements, stmtHandle));
2287
2288 statement->checkPrepared();
2289
2290 const unsigned flags = statement->statement->getFlags(&statusWrapper);
2291 if (status.getState() & IStatus::STATE_ERRORS)
2292 {
2293 return status[1];
2294 }
2295
2296 SQLDAMetadataLauncher inMessage(inSqlda);
2297 SQLDAMetadata::DataBuffer inMsgBuffer;
2298 inMessage.gatherData(inMsgBuffer);
2299
2300 if ((flags & IStatement::FLAG_HAS_CURSOR) && !outSqlda)
2301 {
2302 statement->checkCursorClosed();
2303
2304 statement->openCursor(&statusWrapper, traHandle,
2305 inMessage.metadata, inMsgBuffer.begin(), DELAYED_OUT_FORMAT);
2306 if (status.getState() & IStatus::STATE_ERRORS)
2307 {
2308 return status[1];
2309 }
2310
2311 fb_assert(statement->statement->cursor);
2312 }
2313 else
2314 {
2315 SQLDAMetadataLauncher outMessage(outSqlda);
2316
2317 statement->execute(&statusWrapper, traHandle,
2318 inMessage.metadata, inMsgBuffer.begin(), outMessage.metadata, outMessage.getBuffer());
2319 if (!(status.getState() & IStatus::STATE_ERRORS))
2320 outMessage.scatterData();
2321 }
2322 }
2323 catch (const Exception& e)
2324 {
2325 e.stuffException(&statusWrapper);
2326 }
2327
2328 return status[1];
2329}
2330
2331
2332// Execute a non-SELECT dynamic SQL statement.

Callers

nothing calls this directly

Calls 12

translateHandleFunction · 0.85
checkPreparedMethod · 0.80
checkCursorClosedMethod · 0.80
getFlagsMethod · 0.45
getStateMethod · 0.45
gatherDataMethod · 0.45
openCursorMethod · 0.45
beginMethod · 0.45
executeMethod · 0.45
getBufferMethod · 0.45
scatterDataMethod · 0.45
stuffExceptionMethod · 0.45

Tested by

no test coverage detected