blob: b890c26b362215b715c15aacf4d548fc57b071da (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include "dbpluginstdfilebase.h"
#include "common/unused.h"
#include "db/sqlquery.h"
#include <QFileInfo>
Db *DbPluginStdFileBase::getInstance(const QString &name, const QString &path, const QHash<QString, QVariant> &options, QString *errorMessage)
{
UNUSED(errorMessage);
Db* db = newInstance(name, path, options);
if (!db->openForProbing())
{
delete db;
return nullptr;
}
SqlQueryPtr results = db->exec("SELECT * FROM sqlite_master");
if (results->isError())
{
delete db;
return nullptr;
}
db->closeQuiet();
return db;
}
QString DbPluginStdFileBase::generateDbName(const QVariant &baseValue)
{
QFileInfo file(baseValue.toString());
return file.completeBaseName();
}
|