MCPcopy Create free account
hub / github.com/audacity/audacity / CheckTableExists

Method CheckTableExists

libraries/lib-sqlite-helpers/sqlite/Connection.cpp:141–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141bool Connection::CheckTableExists(std::string_view tableName) const
142{
143 auto stmt = CreateStatement(
144 "SELECT EXISTS(SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?)");
145
146 if (!stmt)
147 return false;
148
149 auto result = stmt->Prepare(tableName).Run();
150
151 if (!result.HasRows())
152 return false;
153
154 for (auto row : result)
155 return row.GetOr(0, false);
156
157 return false;
158}
159
160Error Connection::Execute(std::string_view sql) noexcept
161{

Callers 3

HasAutosaveFunction · 0.80
DropAutosaveFunction · 0.80

Calls 3

PrepareMethod · 0.80
HasRowsMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected