SQLite has no way for a VFS to provide an error message, so when this VFS fails with a specific reason, it records the message on the connection's main database File. This returns (and clears) that message, but only if the given error code matches and the message was recorded during the current operation (otherwise, it's left over from an error that was never reported, such as one that SQLite hand
| 167 | // It returns NULL for connections that don't use this VFS. The caller |
| 168 | // must hold the database connection's mutex (if any). |
| 169 | static const char* TakeErrorMessage(sqlite3* db_handle, int code) { |
| 170 | sqlite3_file* f = NULL; |
| 171 | if (sqlite3_file_control(db_handle, "main", SQLITE_FCNTL_FILE_POINTER, &f) != SQLITE_OK) return NULL; |
| 172 | if (f == NULL || f->pMethods != &main_io_methods) return NULL; |
| 173 | File* file = reinterpret_cast<File*>(f); |
| 174 | const char* message = file->error_code == code && file->error_operation == operation ? file->error_message : NULL; |
| 175 | ClearError(file); |
| 176 | return message; |
| 177 | } |
| 178 | |
| 179 | private: |
| 180 |
nothing calls this directly
no outgoing calls
no test coverage detected