Author: wyoung
Date: Wed Mar 28 17:38:34 2007
New Revision: 1472

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1472&view=rev
Log:
Only saving user inputs in MFC example when login and table retrieval
succeeds.  Otherwise, we risk saving useless values.

Modified:
    trunk/examples/vstudio/mfc/mfc_dlg.cpp

Modified: trunk/examples/vstudio/mfc/mfc_dlg.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/vstudio/mfc/mfc_dlg.cpp?rev=1472&r1=1471&r2=1472&view=diff
==============================================================================
--- trunk/examples/vstudio/mfc/mfc_dlg.cpp (original)
+++ trunk/examples/vstudio/mfc/mfc_dlg.cpp Wed Mar 28 17:38:34 2007
@@ -99,10 +99,8 @@
        WCHAR awcTempBuf[100];
        const int kTempBufSize = sizeof(awcTempBuf) / sizeof(awcTempBuf[0]);
 
-       // Pull user input into our member variables, then save that to the
-       // registry for future use.
+       // Pull user input into our member variables
        UpdateData(TRUE);
-       SaveInputs(sServerAddress, sUserName);
 
        // Clear out the results list, in case this isn't the first time
        // we've come in here.
@@ -134,16 +132,20 @@
        query << "select item from stock";
        mysqlpp::Result res = query.store();
 
-       // Display the result set
        if (res) {
+               // Display the result set
                mysqlpp::Row row;
                for (mysqlpp::Row::size_type i = 0; row = res.at(i); ++i) {
                        if (ToUCS2(awcTempBuf, kTempBufSize, row.at(0))) {
                                AddMessage(awcTempBuf);
                        }
                }
+
+               // Retreive was successful, so save user inputs now
+               SaveInputs(sServerAddress, sUserName);
        }
        else {
+               // Retreive failed
                AddMessage(_T("Failed to get item list:"));
                if (ToUCS2(awcTempBuf, kTempBufSize, query.error().c_str())) {
                        AddMessage(awcTempBuf);


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to