bool {,de}serialization

This commit is contained in:
Hamed Masafi 2019-04-09 11:55:19 +04:30
parent 2c7ee423de
commit 94753fbb2f
5 changed files with 13 additions and 2 deletions

2
3rdparty/serializer vendored

@ -1 +1 @@
Subproject commit b3c550c5bb7c570b1b10492fcedf287c1915af39
Subproject commit 531e2411a5ada2cd468b5382ec7a35396d6f2a88

View File

@ -175,6 +175,9 @@ bool DatabasePrivate::updateDatabase()
if (db.lastError().type() == QSqlError::NoError) {
q->databaseUpdated(last.version(), current.version());
if (!last.count())
q->databaseCreated();
} else {
qWarning("Unable update database, error = %s",
db.lastError().text().toLatin1().data());
@ -541,6 +544,11 @@ QSqlDatabase Database::database()
return d->db;
}
void Database::databaseCreated()
{
}
void Database::databaseUpdated(int oldVersion, int newVersion)
{
Q_UNUSED(oldVersion);

View File

@ -73,6 +73,7 @@ public:
protected:
//remove minor version
virtual void databaseCreated();
virtual void databaseUpdated(int oldVersion, int newVersion);
public slots:

View File

@ -827,6 +827,7 @@ QString SqlGeneratorBase::escapeValue(const QVariant &v) const
qWarning("No field escape rule for: %s", v.typeName());
return QString();
}
return "'" + serialized + "'";
}

View File

@ -138,7 +138,7 @@ Q_OUTOFLINE_TEMPLATE QList<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();
@ -519,6 +519,7 @@ Q_OUTOFLINE_TEMPLATE int Query<T>::update(const AssignmentPhraseList &ph)
d->tableName,
ph,
d->wherePhrase);
QSqlQuery q = d->database->exec(d->sql);
if (m_autoDelete)