8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 00:03:02 +01:00

Trace correctly failed SQL statement prepare attempts and SET TRANSACTION statement.

This commit is contained in:
hvlad 2009-02-02 16:23:05 +00:00
parent 3d04521189
commit a0ab0d9109
2 changed files with 9 additions and 8 deletions

View File

@ -2475,7 +2475,7 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti
ISC_STATUS_ARRAY local_status;
MOVE_CLEAR(local_status, sizeof(local_status));
TraceDSQLPrepare trace(transaction, string_length, string);
TraceDSQLPrepare trace(database->dbb_attachment, string_length, string);
if (client_dialect > SQL_DIALECT_CURRENT)
{
@ -2515,7 +2515,7 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti
statement->req_transaction = transaction;
statement->req_client_dialect = client_dialect;
statement->req_sql_text = FB_NEW(pool) RefString(pool, Firebird::string(pool, string, string_length));
statement->req_traced = false;
statement->req_traced = true;
trace.setStatement(statement);
@ -2698,6 +2698,7 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti
}
catch (const Firebird::Exception&)
{
trace.prepare(res_failed);
release_request(tdbb, statement, true);
throw;
}

View File

@ -35,13 +35,13 @@ namespace Jrd {
class TraceDSQLPrepare
{
public:
TraceDSQLPrepare(jrd_tra* transaction, USHORT string_length, const TEXT* string) :
m_transaction(transaction),
TraceDSQLPrepare(Attachment* attachemnt, USHORT string_length, const TEXT* string) :
m_attachment(attachemnt),
m_request(NULL),
m_string_len(string_length),
m_string(string)
{
m_need_trace = TraceManager::need_dsql_prepare(m_transaction->tra_attachment);
m_need_trace = TraceManager::need_dsql_prepare(m_attachment);
if (!m_need_trace)
return;
@ -80,7 +80,7 @@ public:
if ((result == res_successful) && m_request)
{
TraceSQLStatementImpl stmt(m_request, NULL);
TraceManager::event_dsql_prepare(m_transaction->tra_attachment, m_transaction,
TraceManager::event_dsql_prepare(m_attachment, m_request->req_transaction,
&stmt, millis, result);
}
else
@ -88,14 +88,14 @@ public:
Firebird::string str(*getDefaultMemoryPool(), m_string, m_string_len);
TraceFailedSQLStatement stmt(str);
TraceManager::event_dsql_prepare(m_transaction->tra_attachment, m_transaction,
TraceManager::event_dsql_prepare(m_attachment, m_request->req_transaction,
&stmt, millis, result);
}
}
private:
bool m_need_trace;
jrd_tra* m_transaction;
Attachment* m_attachment;
dsql_req* m_request;
SINT64 m_start_clock;
size_t m_string_len;