seznam / SuperiorMySqlpp

SuperiorMySQL++
GNU Lesser General Public License v3.0
31 stars 20 forks source link

Wrong initialization of Nullable<String> in dynamic result binding #10

Closed jschrotter closed 6 years ago

jschrotter commented 8 years ago

When a Nullable<String> value is bound using dynamic result binding, it's not initialized correctly. I have table with nullable string column, which is filled by a data. Calling Nullable::isValid() returns false, but using operator*() I get correct data from db. The problem might be missing initialization of "engaged" value.

Here's failing testcase for this issue from @tnozicka :

diff --git a/tests/db_access/dynamic_prepared_statements.cpp b/tests/db_access/dynamic_prepared_statements.cpp
index e32750b..612761f 100644
--- a/tests/db_access/dynamic_prepared_statements.cpp
+++ b/tests/db_access/dynamic_prepared_statements.cpp
@@ -148,6 +148,7 @@ go_bandit([](){
             int count = 0;
             while (preparedStatement.fetch())
             {
+                AssertThat(sname.isValid(), IsTrue());
                 auto name = sname->getString();

                 AssertThat(id, Equals(12));
smradCZ commented 6 years ago

Please close this issue. Test case mentioned above is passing now, issue was fixed by https://github.com/seznam/SuperiorMySqlpp/pull/19