[PhoneOrder-commits] SF.net SVN: phoneorder:[58] trunk
Status: Alpha
Brought to you by:
hurikhan
|
From: <hur...@us...> - 2011-08-22 19:05:36
|
Revision: 58
http://phoneorder.svn.sourceforge.net/phoneorder/?rev=58&view=rev
Author: hurikhan
Date: 2011-08-22 19:05:30 +0000 (Mon, 22 Aug 2011)
Log Message:
-----------
Fix saving prices
Since Qt4 migration saving prices was not possible due to a
wrong SQL parameter binding.
Modified Paths:
--------------
trunk/src/po_priceseditor.cpp
Added Paths:
-----------
trunk/bin/export-menu.sh
Added: trunk/bin/export-menu.sh
===================================================================
--- trunk/bin/export-menu.sh (rev 0)
+++ trunk/bin/export-menu.sh 2011-08-22 19:05:30 UTC (rev 58)
@@ -0,0 +1,2 @@
+#!/bin/bash
+mysqldump -u phoneorder -p $* phoneorder groups dishes dishprices ingredients ingprices
Property changes on: trunk/bin/export-menu.sh
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/src/po_priceseditor.cpp
===================================================================
--- trunk/src/po_priceseditor.cpp 2011-05-02 21:50:20 UTC (rev 57)
+++ trunk/src/po_priceseditor.cpp 2011-08-22 19:05:30 UTC (rev 58)
@@ -217,23 +217,25 @@
}
break;
default: // price changed
- QString groupId = dishesList->horizontalHeader ()->label (col);
- if (s.isEmpty ()) // delete dish price
+ QString groupId = dishesList->horizontalHeader()->label(col);
+ if (s.isEmpty()) // delete dish price
{
- query.prepare ("DELETE FROM dishprices WHERE (dishid = ?) AND (groupid = ?)");
- query.bindValue (0, dishId);
- query.bindValue (1, groupId);
- if (query.exec ()) qDebug ("DB updated: %s", query.executedQuery ().ascii ());
+ query.prepare("DELETE FROM dishprices WHERE (dishid = ?) AND (groupid = ?)");
+ query.bindValue(0, dishId);
+ query.bindValue(1, groupId);
+ if (query.exec()) qDebug("DB updated: %s", query.executedQuery().ascii());
}
else // update or insert dish price
{
- double price = s.replace (QChar (','), QChar ('.')).toDouble ();
- s = QString ("%L1") .arg (price, 0, 'f', 2); // FS#6
- dishesList->setText (row, col, s);
- query.prepare ("SELECT dpid FROM dishprices WHERE (dishid = ?) AND (groupid = ?)");
- query.bindValue (1, dishId);
- query.bindValue (2, groupId);
- if (query.exec ())
+ double price = s.replace(QChar(','), QChar('.')).toDouble();
+ s = QString("%L1").arg(price, 0, 'f', 2); // FS#6
+ qDebug("Want change @(%d,%d) = %s; dishId = %s; groupId = %s", row, col, s.ascii(), dishId.ascii(), groupId.ascii());
+ dishesList->setText(row, col, s);
+ qDebug("About to execute SELECT dpid FROM dishprices WHERE (dishid = '%s') AND (groupid = '%s')", dishId.ascii(), groupId.ascii());
+ query.prepare("SELECT dpid FROM dishprices WHERE (dishid = ?) AND (groupid = ?)");
+ query.bindValue(0, dishId);
+ query.bindValue(1, groupId);
+ if (query.exec())
{
qlonglong dpId = -1;
if (query.first ()) dpId = query.value (0).toLongLong ();
@@ -252,6 +254,8 @@
}
if (query.exec ()) qDebug ("DB updated: %s", query.executedQuery ().ascii ());
}
+ else
+ qDebug("dpid query failed! :-( %s", query.executedQuery().ascii());
}
break;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|