Herunterladen als
root/src/schema/sqlitequerybuilder.cpp @ 49762cb7
c22391b2 | Christian Ehringfeld | /*
|
|
* Copyright (C) 2015 Christian Ehringfeld <c.ehringfeld@t-online.de>
|
|||
*
|
|||
* This program is free software; you can redistribute it and/or modify it
|
|||
* under the terms of the GNU Lesser General Public License as published by
|
|||
* the Free Software Foundation.
|
|||
*
|
|||
* This program is distributed in the hope that it will be useful, but
|
|||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|||
* for more details.
|
|||
*
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
|||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
|||
b0bf458e | Christian Ehringfeld | #include "sqlitequerybuilder.h"
|
|
d99101ae | Christian Ehringfeld | #include "../schema.h"
|
|
b0bf458e | Christian Ehringfeld | ||
57d6da31 | Christian Ehringfeld | CuteEntityManager::SqliteQueryBuilder::SqliteQueryBuilder(Schema *schema,
|
|
e0e1ead8 | Christian Ehringfeld | QSharedPointer<CuteEntityManager::Database> database) : QueryBuilder(schema,
|
|
database) {
|
|||
b0bf458e | Christian Ehringfeld | ||
}
|
|||
CuteEntityManager::SqliteQueryBuilder::~SqliteQueryBuilder() {
|
|||
}
|
|||
d99101ae | Christian Ehringfeld | ||
e0e1ead8 | Christian Ehringfeld | QString CuteEntityManager::SqliteQueryBuilder::truncateTable(
|
|
QString tableName) const {
|
|||
abb9e8c5 | Christian Ehringfeld | return "DELETE FROM " + this->schema->quoteTableName(tableName);
|
|
d99101ae | Christian Ehringfeld | }
|
|
e0e1ead8 | Christian Ehringfeld | QString CuteEntityManager::SqliteQueryBuilder::dropIndex(QString name,
|
|
QString tableName) const {
|
|||
8275b945 | Christian Ehringfeld | Q_UNUSED(tableName)
|
|
abb9e8c5 | Christian Ehringfeld | return "DROP INDEX " + this->schema->quoteTableName(name);
|
|
d99101ae | Christian Ehringfeld | }
|
|
e0e1ead8 | Christian Ehringfeld | QString CuteEntityManager::SqliteQueryBuilder::dropColumn(QString tableName,
|
|
8275b945 | Christian Ehringfeld | QString columnName) const {
|
|
Q_UNUSED(tableName)Q_UNUSED(columnName)
|
|||
d99101ae | Christian Ehringfeld | //not supported
|
|
return "";
|
|||
}
|
|||
e0e1ead8 | Christian Ehringfeld | QString CuteEntityManager::SqliteQueryBuilder::renameColumn(QString tableName,
|
|
QString oldName,
|
|||
QString newName) const {
|
|||
8275b945 | Christian Ehringfeld | Q_UNUSED(tableName)Q_UNUSED(oldName)Q_UNUSED(newName)
|
|
d99101ae | Christian Ehringfeld | //not supported
|
|
return "";
|
|||
}
|
|||
e0e1ead8 | Christian Ehringfeld | QString CuteEntityManager::SqliteQueryBuilder::addForeignKey(QString name,
|
|
QString tableName,
|
|||
QStringList columns,
|
|||
QString refTableName, QStringList refColumns, QString deleteConstraint,
|
|||
QString updateConstraint) const {
|
|||
8275b945 | Christian Ehringfeld | Q_UNUSED(tableName)Q_UNUSED(name)Q_UNUSED(columns)Q_UNUSED(
|
|
refTableName)Q_UNUSED(refColumns)Q_UNUSED(deleteConstraint)Q_UNUSED(
|
|||
updateConstraint)
|
|||
d99101ae | Christian Ehringfeld | //not supported
|
|
9971e7d2 | Christian Ehringfeld | if (this->supportsForeignKeys()) {
|
|
return QueryBuilder::addForeignKey(name, tableName, columns, refTableName,
|
|||
refColumns, deleteConstraint, updateConstraint);
|
|||
}
|
|||
d99101ae | Christian Ehringfeld | return "";
|
|
}
|
|||
e0e1ead8 | Christian Ehringfeld | QString CuteEntityManager::SqliteQueryBuilder::dropForeignKey(QString name,
|
|
QString tableName) const {
|
|||
8275b945 | Christian Ehringfeld | Q_UNUSED(name)Q_UNUSED(tableName)
|
|
9971e7d2 | Christian Ehringfeld | if (this->supportsForeignKeys()) {
|
|
return QueryBuilder::dropForeignKey(name, tableName);
|
|||
}
|
|||
d99101ae | Christian Ehringfeld | //not supported
|
|
return "";
|
|||
}
|
|||
e0e1ead8 | Christian Ehringfeld | QString CuteEntityManager::SqliteQueryBuilder::alterColumn(QString tableName,
|
|
QString columnName,
|
|||
d99101ae | Christian Ehringfeld | QString newType) const {
|
|
8275b945 | Christian Ehringfeld | Q_UNUSED(tableName)Q_UNUSED(newType)Q_UNUSED(columnName)
|
|
d99101ae | Christian Ehringfeld | //not supported
|
|
return "";
|
|||
}
|
|||
e0e1ead8 | Christian Ehringfeld | QString CuteEntityManager::SqliteQueryBuilder::addPrimaryKey(QString name,
|
|
QString tableName,
|
|||
d99101ae | Christian Ehringfeld | QStringList columns) const {
|
|
8275b945 | Christian Ehringfeld | Q_UNUSED(tableName)Q_UNUSED(name)Q_UNUSED(columns)
|
|
d99101ae | Christian Ehringfeld | //not supported
|
|
return "";
|
|||
}
|
|||
e0e1ead8 | Christian Ehringfeld | QString CuteEntityManager::SqliteQueryBuilder::dropPrimaryKey(QString name,
|
|
QString tableName) const {
|
|||
8275b945 | Christian Ehringfeld | Q_UNUSED(tableName)Q_UNUSED(name)
|
|
d99101ae | Christian Ehringfeld | //not supported
|
|
return "";
|
|||
}
|
|||
b0e92bc6 | Christian Ehringfeld | ||
bool CuteEntityManager::SqliteQueryBuilder::supportsForeignKeys() const {
|
|||
return false;
|
|||
}
|