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

Method getStatement

src/dsql/DsqlStatementCache.cpp:73–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73RefPtr<DsqlStatement> DsqlStatementCache::getStatement(thread_db* tdbb, const string& text, USHORT clientDialect,
74 bool isInternalRequest)
75{
76 RefStrPtr key;
77 buildStatementKey(tdbb, key, text, clientDialect, isInternalRequest);
78
79 if (const auto entryPtr = map.get(key))
80 {
81 const auto entry = *entryPtr;
82 auto dsqlStatement(entry->dsqlStatement);
83
84 string verifyKey;
85 buildVerifyKey(tdbb, verifyKey, isInternalRequest);
86
87 FB_SIZE_T verifyPos;
88 if (!entry->verifyCache.find(verifyKey, verifyPos))
89 {
90 dsqlStatement->getStatement()->verifyAccess(tdbb);
91 entry->verifyCache.insert(verifyPos, verifyKey);
92 }
93
94 if (!entry->active)
95 {
96 entry->dsqlStatement->setCacheKey(key);
97 // Active statement has cacheKey and will tell us when it's going to be released.
98 entry->dsqlStatement->release();
99
100 entry->active = true;
101
102 cacheSize -= entry->size;
103
104 activeStatementList.splice(activeStatementList.end(), inactiveStatementList, entry);
105 }
106
107#ifdef DSQL_STATEMENT_CACHE_DEBUG
108 dump();
109#endif
110
111 return dsqlStatement;
112 }
113
114 return {};
115}
116
117void DsqlStatementCache::putStatement(thread_db* tdbb, const string& text, USHORT clientDialect,
118 bool isInternalRequest, RefPtr<DsqlStatement> dsqlStatement)

Callers

nothing calls this directly

Calls 9

verifyAccessMethod · 0.80
setCacheKeyMethod · 0.80
spliceMethod · 0.80
dumpFunction · 0.50
getMethod · 0.45
findMethod · 0.45
insertMethod · 0.45
releaseMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected