|
QGroundControl
Ground Control Station for MAVLink Drones
|
Lightweight SQL utilities shared across QGC components. More...
Classes | |
| class | ScopedConnection |
| RAII wrapper around QSqlDatabase::addDatabase / removeDatabase. More... | |
| class | Transaction |
| RAII wrapper around QSqlDatabase::transaction()/commit()/rollback(). More... | |
Functions | |
| QString | escapeLikePattern (const QString &text) |
| QString | placeholders (int n) |
| void | applySqlitePragmas (QSqlDatabase &db) |
| std::optional< int > | userVersion (QSqlDatabase &db) |
| bool | setUserVersion (QSqlDatabase &db, int v) |
Lightweight SQL utilities shared across QGC components.
| void QGCSqlHelper::applySqlitePragmas | ( | QSqlDatabase & | db | ) |
Applies standard QGC pragmas: WAL journal mode, NORMAL synchronous, foreign_keys = ON.
Definition at line 33 of file QGCSqlHelper.cc.
Referenced by QGCTileCacheDatabase::connectDB(), and QGCSqlHelper::ScopedConnection::ScopedConnection().
| QString QGCSqlHelper::escapeLikePattern | ( | const QString & | text | ) |
Escapes SQL LIKE wildcards (%, _, ) so the string matches literally. Use with "LIKE ? ESCAPE '\\'" in the query.
Definition at line 9 of file QGCSqlHelper.cc.
| QString QGCSqlHelper::placeholders | ( | int | n | ) |
Returns "?,?,?" with n placeholders for use in IN-clauses. E.g. "DELETE FROM T WHERE id IN (" + placeholders(n) + ")".
Definition at line 18 of file QGCSqlHelper.cc.
Referenced by QGCTileCacheDatabase::createTileSet(), QGCTileCacheDatabase::deleteTileSet(), and QGCTileCacheDatabase::getTileDownloadList().
| bool QGCSqlHelper::setUserVersion | ( | QSqlDatabase & | db, |
| int | v | ||
| ) |
Definition at line 50 of file QGCSqlHelper.cc.
| std::optional< int > QGCSqlHelper::userVersion | ( | QSqlDatabase & | db | ) |
PRAGMA user_version — read/write the SQLite schema version integer. Returns std::nullopt on failure.
Definition at line 41 of file QGCSqlHelper.cc.