diff options
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/db/dbsqlite3.cpp')
| -rw-r--r-- | SQLiteStudio3/coreSQLiteStudio/db/dbsqlite3.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/dbsqlite3.cpp b/SQLiteStudio3/coreSQLiteStudio/db/dbsqlite3.cpp index 76ddd20..296b7d1 100644 --- a/SQLiteStudio3/coreSQLiteStudio/db/dbsqlite3.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/db/dbsqlite3.cpp @@ -15,6 +15,21 @@ bool DbSqlite3::complete(const QString& sql) return Sqlite3::complete(sql.toUtf8().constData()); } +bool DbSqlite3::isDbFile(const QString &path) +{ + QFile file(path); + if (!file.open(QIODevice::ReadOnly)) { + return false; + } + + QByteArray data = file.read(16); + file.close(); + if (data.size() < 16) + return false; + + return data == QByteArrayLiteral("SQLite format 3\000"); +} + Db* DbSqlite3::clone() const { return new DbSqlite3(name, path, connOptions); |
