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

Method putStatement

src/dsql/DsqlStatementCache.cpp:117–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117void DsqlStatementCache::putStatement(thread_db* tdbb, const string& text, USHORT clientDialect,
118 bool isInternalRequest, RefPtr<DsqlStatement> dsqlStatement)
119{
120 fb_assert(dsqlStatement->isDml());
121
122 ensureLockIsCreated(tdbb);
123
124 if (isEmpty())
125 {
126 ThreadStatusGuard tempStatus(tdbb);
127
128 if (!LCK_convert(tdbb, lock, LCK_SW, LCK_NO_WAIT))
129 return;
130 }
131
132 const unsigned statementSize = dsqlStatement->getSize();
133
134 RefStrPtr key;
135 buildStatementKey(tdbb, key, text, clientDialect, isInternalRequest);
136
137 StatementEntry newStatement(getPool());
138 newStatement.key = key;
139 newStatement.size = statementSize;
140 newStatement.dsqlStatement = std::move(dsqlStatement);
141 newStatement.active = true;
142
143 string verifyKey;
144 buildVerifyKey(tdbb, verifyKey, isInternalRequest);
145 newStatement.verifyCache.add(verifyKey);
146
147 newStatement.dsqlStatement->setCacheKey(key);
148 // Active statement has cacheKey and will tell us when it's going to be released.
149 newStatement.dsqlStatement->release();
150
151 activeStatementList.pushBack(std::move(newStatement));
152 map.put(key, --activeStatementList.end());
153
154#ifdef DSQL_STATEMENT_CACHE_DEBUG
155 dump();
156#endif
157}
158
159void DsqlStatementCache::removeStatement(thread_db* tdbb, DsqlStatement* statement)
160{

Callers 1

prepareStatementFunction · 0.45

Calls 11

LCK_convertFunction · 0.85
setCacheKeyMethod · 0.80
pushBackMethod · 0.80
moveFunction · 0.50
dumpFunction · 0.50
isDmlMethod · 0.45
getSizeMethod · 0.45
addMethod · 0.45
releaseMethod · 0.45
putMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected