本文整理汇总了C++中Attachment::prepareStatement方法的典型用法代码示例。如果您正苦于以下问题:C++ Attachment::prepareStatement方法的具体用法?C++ Attachment::prepareStatement怎么用?C++ Attachment::prepareStatement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachment
的用法示例。
在下文中一共展示了Attachment::prepareStatement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
void ExecuteStatement::execute(Jrd::thread_db* tdbb, jrd_req* request, DSC* desc)
{
SET_TDBB(tdbb);
Attachment* attachment = tdbb->getAttachment();
jrd_tra* const transaction = tdbb->getTransaction();
if (transaction->tra_callback_count >= MAX_CALLBACKS)
{
ERR_post(Arg::Gds(isc_exec_sql_max_call_exceeded));
}
Firebird::string sqlStatementText;
getString(tdbb, sqlStatementText, desc, request);
transaction->tra_callback_count++;
try
{
AutoPtr<PreparedStatement> stmt(attachment->prepareStatement(
tdbb, *tdbb->getDefaultPool(), transaction, sqlStatementText));
// Other requests appear to be incorrect in this context
const long requests =
(1 << REQ_INSERT) | (1 << REQ_DELETE) | (1 << REQ_UPDATE) |
(1 << REQ_DDL) | (1 << REQ_SET_GENERATOR) | (1 << REQ_EXEC_PROCEDURE) |
(1 << REQ_EXEC_BLOCK);
if (!((1 << stmt->getRequest()->req_type) & requests))
{
ERR_post(Arg::Gds(isc_sqlerr) << Arg::Num(-902) <<
Arg::Gds(isc_exec_sql_invalid_req) << Arg::Str(sqlStatementText));
}
stmt->execute(tdbb, transaction);
fb_assert(transaction == tdbb->getTransaction());
}
catch (const Firebird::Exception&)
{
transaction->tra_callback_count--;
throw;
}
transaction->tra_callback_count--;
}