This commit is contained in:
Hamed Masafi 2019-06-19 13:47:09 +04:30
commit 6254c11267
5 changed files with 10 additions and 4 deletions

View File

@ -339,5 +339,4 @@ QString PostgreSqlGenerator::createConditionalPhrase(const PhraseData *d) const
return SqlGeneratorBase::createConditionalPhrase(d); return SqlGeneratorBase::createConditionalPhrase(d);
} }
NUT_END_NAMESPACE NUT_END_NAMESPACE

View File

@ -159,8 +159,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

View File

@ -186,4 +186,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

View File

@ -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

View File

@ -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);