- OrmException(const QString& text) : mText(text) {}
- virtual ~OrmException(){}
+ OrmException(const QString& text) : std::runtime_error(text.toStdString()), mText(text) {}
+ virtual ~OrmException() throw() {}
- OrmNoObjectException() : OrmException("No object exception"){}
- ~OrmNoObjectException(){}
+ OrmNoObjectException() : OrmException("SQL query expects one record but found none."){}
+ ~OrmNoObjectException() throw() {}
};
class OrmSqlException : public OrmException
{
public:
OrmSqlException(const QString& text) : OrmException( QString("Sql error: ") + text ) {}
};
class OrmSqlException : public OrmException
{
public:
OrmSqlException(const QString& text) : OrmException( QString("Sql error: ") + text ) {}
-// if the value is not specified as an argument,
-// it's taken from the reford itself
+// if the value is not specified as an argument,
+// it's taken from the record itself
// see also: setValue() method for more details
template <typename T>
void OrmRecord<T>::update(QString col, QVariant value)
// see also: setValue() method for more details
template <typename T>
void OrmRecord<T>::update(QString col, QVariant value)
else // take 'col' value from the record; see setValue()
query.bindValue(":col", convertToDb(this->value(col), this->value(col).type()));
query.bindValue(":id", this->value("id"));
else // take 'col' value from the record; see setValue()
query.bindValue(":col", convertToDb(this->value(col), this->value(col).type()));
query.bindValue(":id", this->value("id"));
- return value.toDateTime().toTime_t();
+ QDateTime dateTime = value.toDateTime();
+ dateTime.setTimeSpec(Qt::UTC); // this is to avoid that dateTime.toTime_t changes the time depending on the local time zone
+ return dateTime.toTime_t();