MCPcopy Create free account
hub / github.com/WiseLibs/better-sqlite3 / FindMainFile

Method FindMainFile

src/util/fd-vfs.cpp:268–275  ·  view source on GitHub ↗

Given the name of a journal, returns the main database File that it belongs to, or NULL. This must be called while holding Mutex().

Source from the content-addressed store, hash-verified

266 // Given the name of a journal, returns the main database File that it
267 // belongs to, or NULL. This must be called while holding Mutex().
268 static File* FindMainFile(const char* journal_name) {
269 size_t length = strlen(journal_name);
270 size_t suffix_length = strlen(JOURNAL_SUFFIX);
271 if (length <= suffix_length) return NULL;
272 size_t name_length = length - suffix_length;
273 if (strcmp(journal_name + name_length, JOURNAL_SUFFIX) != 0) return NULL;
274 return FindMainFileByPrefix(journal_name, name_length);
275 }
276
277 // Records an error message on the given main database File (see
278 // TakeErrorMessage()). The File's connection must be the caller (so we're

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected