Date: Wednesday, March 22, 2006 @ 16:03:52
  Author: marc
    Path: /cvsroot/carob/odbsequoia/src

Modified: connect.cpp (1.15 -> 1.16)

!SQLGetPrivateProfileString  becomes 0 >= SQLGetPrivateProfileString, clearer 
and safer.


-------------+
 connect.cpp |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)


Index: odbsequoia/src/connect.cpp
diff -u odbsequoia/src/connect.cpp:1.15 odbsequoia/src/connect.cpp:1.16
--- odbsequoia/src/connect.cpp:1.15     Wed Mar 22 15:35:04 2006
+++ odbsequoia/src/connect.cpp  Wed Mar 22 16:03:52 2006
@@ -93,27 +93,28 @@
     // when we require the user to provide a value.
 
     // TODO: call SQLInstallerError() to throw better diags
+    // BTW how could we fail when providing a default value?
 
     // Slurp DSN information from odbc.ini into ConnectionParameters
-    if (!SQLGetPrivateProfileString(cdsn, SERVER_INI, "localhost",
-       temp, MAX_VALUE_LEN, ODBC_INI))
+    if (0 >= SQLGetPrivateProfileString(cdsn, SERVER_INI, "localhost",
+                                        temp, MAX_VALUE_LEN, ODBC_INI))
         return SQL_ERROR; // TODO: diags. On the other hand it can hardly fail.
     std::wstring serverhost = fromString(std::string(temp));
 
-    if (!SQLGetPrivateProfileString(cdsn, PORT_INI, "25322",
-       temp, MAX_VALUE_LEN, ODBC_INI))
+    if (0 >= SQLGetPrivateProfileString(cdsn, PORT_INI, "25322",
+                                        temp, MAX_VALUE_LEN, ODBC_INI))
         return SQL_ERROR; // TODO: diags. On the other hand it can hardly fail.
     in_port_t port = atoi(temp);
 
-    if (!SQLGetPrivateProfileString(cdsn, DATABASE_INI, "",
-       temp, MAX_VALUE_LEN, ODBC_INI))
+    if (0 >= SQLGetPrivateProfileString(cdsn, DATABASE_INI, "",
+                                        temp, MAX_VALUE_LEN, ODBC_INI))
         throw ODBSeqException(L"???", L"'" WIDENMACRO(DATABASE_INI) L"'"
                               L" parameter not found in .ini file");
     std::wstring vdbname = fromString(std::string(temp));
 
-    if (!SQLGetPrivateProfileString(cdsn, BACKEND_IDS_INI, 
DEFAULT_BACKEND_IDS_INI,
-       temp, MAX_VALUE_LEN, ODBC_INI))
-        return SQL_ERROR; // TODO: diags
+    if (0 >= SQLGetPrivateProfileString(cdsn, BACKEND_IDS_INI, 
DEFAULT_BACKEND_IDS_INI,
+                                        temp, MAX_VALUE_LEN, ODBC_INI))
+        return SQL_ERROR; // TODO: diags. On the other hand it can hardly fail.
     this->backend_diagids = fromString(std::string(temp));
 
 

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to