Fix some typo bugs in Database query
Add Group/UnGroup/UpdateNextMonths buttons Display correct title in AccountPannel
This commit is contained in:
@@ -467,7 +467,7 @@ bool Database::GetOperation(int id, Operation* op)
|
||||
QString req;
|
||||
QSqlQuery query(_db);
|
||||
|
||||
req = QString("SELECT * FROM operation WHERE id='%1").arg(QString::number(id));
|
||||
req = QString("SELECT * FROM operation WHERE id='%1'").arg(QString::number(id));
|
||||
|
||||
EXECUTE_SQL_QUERY(req, false);
|
||||
|
||||
@@ -569,10 +569,10 @@ void Database::UpdateOperation(User* user, Operation& op, bool checkTransfert)
|
||||
|
||||
ESCAPE_CHARS(op.description);
|
||||
|
||||
req = "UPDATE operation SET parent='%1', account='%2', year='%3'n month='%4', day='%5', amount='%6', description=\"%7\", category='%8'" ;
|
||||
req = "UPDATE operation SET parent='%1', account='%2', year='%3', month='%4', day='%5', amount='%6', description=\"%7\", category='%8'" ;
|
||||
req = req.arg((op.parent) ? QString::number(op.parent) : "", QString::number(op.account), QString::number(op.year), QString::number(op.month),
|
||||
QString::number(op.day), DoubleToString(op.amount), op.description, QString::number(op.category));
|
||||
req += "fix_cost='%1', checked='%2', transfert='%3', meta='%4', virtual='%5', formula='%6' WHERE id='%7'";
|
||||
req += ", fix_cost='%1', checked='%2', transfert='%3', meta='%4', virtual='%5', formula='%6' WHERE id='%7'";
|
||||
req = req.arg(QString::number(op.fix_cost), QString::number(op.checked), (op.transfert) ? QString::number(op.transfert): "",
|
||||
QString::number(op.meta), QString::number(op._virtual), op.formula, QString::number(op.id));
|
||||
|
||||
@@ -588,6 +588,7 @@ int Database::AddOperation(User* user, Operation& op, bool checkTransfert)
|
||||
QSqlRecord set;
|
||||
QSqlQuery query(_db);
|
||||
|
||||
|
||||
ESCAPE_CHARS(op.description);
|
||||
|
||||
req = "INSERT INTO operation ('user', 'parent', 'account', 'year', 'month', 'day', 'amount', 'description', 'category', 'fix_cost', 'formula', 'transfert', 'meta', 'virtual') VALUES ('%1', '%2', '%3', '%4', '%5', '%6', '%7', '%8'" ;
|
||||
@@ -597,7 +598,11 @@ int Database::AddOperation(User* user, Operation& op, bool checkTransfert)
|
||||
req = req.arg(QString::number(op.category), QString::number(op.fix_cost), op.formula, (op.transfert) ? QString::number(op.transfert): "",
|
||||
QString::number(op.meta), QString::number(op._virtual));
|
||||
|
||||
EXECUTE_SQL_UPDATE(req, 0);
|
||||
if (!query.exec(req))
|
||||
{
|
||||
QMessageBox::critical(0, _("Error"), _("Update failed !\n") + req);
|
||||
return 0;
|
||||
}
|
||||
|
||||
op.id = query.lastInsertId().toInt();
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#define EXECUTE_SQL_UPDATE_WITH_CODE(req, return_value, code_if_fail, code_if_syntax_fail) \
|
||||
do { \
|
||||
QSqlQuery query; \
|
||||
if (!query.exec(req)) \
|
||||
if (!query.exec(req)) \
|
||||
{ \
|
||||
QMessageBox::critical(0, _("Error"), _("Update failed !\n") + req); \
|
||||
std::cerr << __FUNCTION__ << "\n" ; \
|
||||
|
||||
Reference in New Issue
Block a user