minor bug fix [skip ci]

This commit is contained in:
Hamed Masafi 2019-06-19 13:54:58 +04:30
parent 6254c11267
commit a199d91135
4 changed files with 5 additions and 9 deletions

View File

@ -170,7 +170,7 @@ QString PostgreSqlGenerator::fieldType(FieldModel *field)
case QMetaType::QJsonValue:
case QMetaType::QJsonObject:
case QMetaType::QJsonDocument:
return "JSON";
return "JSONB";
case QMetaType::QStringList:
return "TEXT[]";

View File

@ -159,6 +159,9 @@ protected:
QString agregateText(const AgregateType &t, const QString &arg = QString()) const;
QString fromTableText(const QString &tableName, QString &joinClassName, QString &orderBy) const;
// QString createWhere(QList<WherePhrase> &wheres);
void replaceTableNames(QString &command);
void removeTableNames(QString &command);
};
NUT_END_NAMESPACE

View File

@ -186,11 +186,4 @@ void SqlServerGenerator::appendSkipTake(QString &sql, int skip, int take)
.arg(skip).arg(take));
}
void SqlServerGenerator::replaceTableNames(QString &command)
{
foreach (TableModel *m, TableModel::allModels())
command = command
.replace("[" + m->className() + "]", m->name() );
}
NUT_END_NAMESPACE

View File

@ -177,7 +177,7 @@ Q_OUTOFLINE_TEMPLATE RowList<T> Query<T>::toList(int count)
d->sql = d->database->sqlGenertor()->selectCommand(
d->tableName, d->fieldPhrase, d->wherePhrase, d->orderPhrase,
d->relations, d->skip, d->take);
qDebug()<<d->sql;
QSqlQuery q = d->database->exec(d->sql);
if (q.lastError().isValid()) {
qDebug() << q.lastError().text();