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

Method prepare_statement

src/remote/server/server.cpp:4909–5009  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4907
4908
4909ISC_STATUS rem_port::prepare_statement(P_SQLST * prepareL, PACKET* sendL)
4910{
4911/*****************************************
4912 *
4913 * p r e p a r e _ s t a t e m e n t
4914 *
4915 *****************************************
4916 *
4917 * Functional description
4918 * Prepare a dynamic SQL statement for execution.
4919 *
4920 *****************************************/
4921 Rtr* transaction = NULL;
4922 Rsr* statement;
4923
4924 // Do not call CHECK_HANDLE if this is the start of a transaction
4925 if (prepareL->p_sqlst_transaction)
4926 {
4927 getHandle(transaction, prepareL->p_sqlst_transaction);
4928 }
4929 getHandle(statement, prepareL->p_sqlst_statement);
4930
4931 HalfStaticArray<UCHAR, 1024> local_buffer, info_buffer;
4932 ULONG infoLength = prepareL->p_sqlst_items.cstr_length;
4933 UCHAR* const info = info_buffer.getBuffer(infoLength + 1);
4934 UCHAR* const buffer = local_buffer.getBuffer(prepareL->p_sqlst_buffer_length);
4935
4936 // stuff isc_info_length in front of info items buffer
4937 *info = isc_info_length;
4938 memmove(info + 1, prepareL->p_sqlst_items.cstr_address, infoLength++);
4939 const unsigned int flags = StatementMetadata::buildInfoFlags(infoLength, info);
4940
4941 ITransaction* iface = NULL;
4942 if (transaction)
4943 iface = transaction->rtr_iface;
4944
4945 LocalStatus ls;
4946 CheckStatusWrapper status_vector(&ls);
4947
4948 if (statement->rsr_iface)
4949 {
4950 statement->rsr_iface->free(&status_vector);
4951 if (status_vector.getState() & IStatus::STATE_ERRORS)
4952 return this->send_response(sendL, 0, 0, &status_vector, false);
4953 }
4954
4955 statement->rsr_cursor_name = "";
4956
4957 Rdb* rdb = statement->rsr_rdb;
4958 if (bad_db(&status_vector, rdb))
4959 {
4960 return this->send_response(sendL, 0, 0, &status_vector, true);
4961 }
4962
4963 statement->rsr_iface = rdb->rdb_iface->prepare(&status_vector,
4964 iface, prepareL->p_sqlst_SQL_str.cstr_length,
4965 reinterpret_cast<const char*>(prepareL->p_sqlst_SQL_str.cstr_address),
4966 prepareL->p_sqlst_SQL_dialect, flags);

Callers 1

process_packetFunction · 0.80

Calls 11

send_responseMethod · 0.95
bad_dbFunction · 0.85
REMOTE_reset_statementFunction · 0.85
check_statement_typeFunction · 0.85
getBufferMethod · 0.45
freeMethod · 0.45
getStateMethod · 0.45
prepareMethod · 0.45
getInfoMethod · 0.45
clearMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected