MSSql and PostgreSql dose not support `
This commit is contained in:
parent
e71a7ac2ed
commit
dda0a5c91d
|
|
@ -122,5 +122,11 @@ QString PostgreSqlGenerator::diff(FieldModel *oldField, FieldModel *newField)
|
||||||
return sql;
|
return sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PostgreSqlGenerator::replaceTableNames(QString &command)
|
||||||
|
{
|
||||||
|
foreach (TableModel *m, TableModel::allModels())
|
||||||
|
command = command
|
||||||
|
.replace("[" + m->className() + "]", m->name() );
|
||||||
|
}
|
||||||
|
|
||||||
NUT_END_NAMESPACE
|
NUT_END_NAMESPACE
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@ public:
|
||||||
QString fieldType(FieldModel *field);
|
QString fieldType(FieldModel *field);
|
||||||
|
|
||||||
QString diff(FieldModel *oldField, FieldModel *newField);
|
QString diff(FieldModel *oldField, FieldModel *newField);
|
||||||
|
|
||||||
|
void replaceTableNames(QString &command);
|
||||||
};
|
};
|
||||||
|
|
||||||
NUT_END_NAMESPACE
|
NUT_END_NAMESPACE
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,11 @@ public:
|
||||||
virtual QString phrase(const PhraseData *d) const;
|
virtual QString phrase(const PhraseData *d) const;
|
||||||
virtual QString operatorString(const PhraseData::Condition &cond) const;
|
virtual QString operatorString(const PhraseData::Condition &cond) const;
|
||||||
virtual void appendSkipTake(QString &sql, int skip = -1, int take = -1);
|
virtual void appendSkipTake(QString &sql, int skip = -1, int take = -1);
|
||||||
|
|
||||||
|
|
||||||
|
virtual void replaceTableNames(QString &command);
|
||||||
|
virtual void removeTableNames(QString &command);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString createConditionalPhrase(const PhraseData *d) const;
|
QString createConditionalPhrase(const PhraseData *d) const;
|
||||||
QString createFieldPhrase(const PhraseList &ph);
|
QString createFieldPhrase(const PhraseList &ph);
|
||||||
|
|
@ -137,8 +142,6 @@ protected:
|
||||||
QString agregateText(const AgregateType &t, const QString &arg = QString()) const;
|
QString agregateText(const AgregateType &t, const QString &arg = QString()) const;
|
||||||
QString fromTableText(const QString &tableName, QString &joinClassName, QString &orderBy) const;
|
QString fromTableText(const QString &tableName, QString &joinClassName, QString &orderBy) const;
|
||||||
// QString createWhere(QList<WherePhrase> &wheres);
|
// QString createWhere(QList<WherePhrase> &wheres);
|
||||||
void replaceTableNames(QString &command);
|
|
||||||
void removeTableNames(QString &command);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NUT_END_NAMESPACE
|
NUT_END_NAMESPACE
|
||||||
|
|
|
||||||
|
|
@ -141,4 +141,11 @@ void SqlServerGenerator::appendSkipTake(QString &sql, int skip, int take)
|
||||||
.arg(skip).arg(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
|
NUT_END_NAMESPACE
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ public:
|
||||||
QString escapeValue(const QVariant &v) const;
|
QString escapeValue(const QVariant &v) const;
|
||||||
void appendSkipTake(QString &sql, int skip, int take);
|
void appendSkipTake(QString &sql, int skip, int take);
|
||||||
|
|
||||||
|
void replaceTableNames(QString &command);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NUT_END_NAMESPACE
|
NUT_END_NAMESPACE
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class Score : public Nut::Table
|
||||||
NUT_DECLARE_FIELD(int, score, score, setScore)
|
NUT_DECLARE_FIELD(int, score, score, setScore)
|
||||||
|
|
||||||
NUT_FOREGION_KEY(Post, int, post, post, setPost)
|
NUT_FOREGION_KEY(Post, int, post, post, setPost)
|
||||||
NUT_FOREGION_KEY(User, int, user, user, setUser)
|
NUT_FOREGION_KEY(User, QUuid, author, author, setAuthor)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Q_INVOKABLE Score(QObject *parent = Q_NULLPTR);
|
Q_INVOKABLE Score(QObject *parent = Q_NULLPTR);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue