Hello,

 I'm just starting to use SOCI so sorry in advance if I'm missing something
obvious but is there any way to detect if a "delete" SQL statement affected
any rows? I thought that got_data() would return false if it didn't delete
anything but at least with the ODBC backend this is not the case as it is
always true.

 Looking at the code I see that odbc_statement_backend::execute() always
returns ef_success in this case (as fetch() is not called), but is this
really the right thing to do if the returned value is SQL_NO_DATA? Perhaps
something like this:

--- a/src/backends/odbc/statement.cpp
+++ b/src/backends/odbc/statement.cpp
@@ -157,6 +157,11 @@ odbc_statement_backend::execute(int number)
     SQLCloseCursor(hstmt_);

     SQLRETURN rc = SQLExecute(hstmt_);
+    if (SQL_NO_DATA == rc)
+    {
+        return ef_no_data;
+    }
+
     if (is_odbc_error(rc))
     {
         throw odbc_soci_error(SQL_HANDLE_STMT, hstmt_,


should simply be added there?

 And if the code is correct, is there some other way to check whether
anything was deleted or not? get_affected_rows() is not implemented for the
ODBC backend and I can't think of anything else.

 Thanks in advance for any advice!
VZ

Attachment: pgpwfFDvCQtPt.pgp
Description: PGP signature

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to