aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/db/abstractdb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/db/abstractdb.cpp')
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/abstractdb.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/abstractdb.cpp b/SQLiteStudio3/coreSQLiteStudio/db/abstractdb.cpp
index 70037b0..9bfb46f 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/abstractdb.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/abstractdb.cpp
@@ -11,6 +11,7 @@
#include "services/sqliteextensionmanager.h"
#include "log.h"
#include "parser/lexer.h"
+#include "common/compatibility.h"
#include <QDebug>
#include <QTime>
#include <QWriteLocker>
@@ -211,7 +212,7 @@ QString AbstractDb::generateUniqueDbNameNoLock()
ReadWriteLocker::Mode AbstractDb::getLockingMode(const QString &query, Flags flags)
{
- return ReadWriteLocker::getMode(query, getDialect(), flags.testFlag(Flag::NO_LOCK));
+ return ReadWriteLocker::getMode(query, flags.testFlag(Flag::NO_LOCK));
}
QString AbstractDb::getName() const
@@ -229,21 +230,13 @@ quint8 AbstractDb::getVersion() const
return version;
}
-Dialect AbstractDb::getDialect() const
-{
- if (version == 2)
- return Dialect::Sqlite2;
- else
- return Dialect::Sqlite3;
-}
-
QString AbstractDb::getEncoding()
{
bool doClose = false;
if (!isOpen())
{
if (!openQuiet())
- return QString::null;
+ return QString();
doClose = true;
}
@@ -402,7 +395,7 @@ void AbstractDb::initAfterOpen()
void AbstractDb::checkForDroppedObject(const QString& query)
{
- TokenList tokens = Lexer::tokenize(query, getDialect());
+ TokenList tokens = Lexer::tokenize(query);
tokens.trim(Token::OPERATOR, ";");
if (tokens.size() == 0)
return;
@@ -441,7 +434,7 @@ void AbstractDb::checkForDroppedObject(const QString& query)
else
object = tokens.first()->value;
- object = stripObjName(object, getDialect());
+ object = stripObjName(object);
if (type == "TABLE")
emit dbObjectDeleted(database, object, DbObjectType::TABLE);
@@ -627,7 +620,7 @@ QString AbstractDb::attach(Db* otherDb, bool silent)
{
QWriteLocker locker(&dbOperLock);
if (!isOpenInternal())
- return QString::null;
+ return QString();
if (attachedDbMap.containsRight(otherDb))
{
@@ -644,7 +637,7 @@ QString AbstractDb::attach(Db* otherDb, bool silent)
else
qDebug() << QString("Error attaching database %1: %2").arg(otherDb->getName()).arg(results->getErrorText());
- return QString::null;
+ return QString();
}
attachedDbMap.insert(attName, otherDb);
@@ -711,14 +704,14 @@ const QHash<Db *, QString> &AbstractDb::getAttachedDatabases()
QSet<QString> AbstractDb::getAllAttaches()
{
QReadLocker locker(&dbOperLock);
- QSet<QString> attaches = attachedDbMap.leftValues().toSet();
+ QSet<QString> attaches = toSet(attachedDbMap.leftValues());
// TODO query database for attached databases and unite them here
return attaches;
}
QString AbstractDb::getUniqueNewObjectName(const QString &attachedDbName)
{
- QString dbName = getPrefixDb(attachedDbName, getDialect());
+ QString dbName = getPrefixDb(attachedDbName);
QSet<QString> existingNames;
SqlQueryPtr results = exec(QString("SELECT name FROM %1.sqlite_master").arg(dbName));