List:MySQL++« Previous MessageNext Message »
From:Kemet Date:May 7 2011 10:08pm
Subject:Re: SSQLS with BINARY column is sometimes not escaped
View as plain text  
Update of the problem:

After inspecting some more the internal variables of the mysqlpp::sql_blob 
and adding some debug code, I found the following:

A) assigning value from within the C++ program:
    * The buffer_.counted_.type_.num_ is set to 25, which corresponds to 
"VARCHAR NOT NULL".
    * If escape_q is called, it returns TRUE.
    * Everything works as expected.

B) reading data from database:
    * num_ is set to 51, which corresponds to "VARCHAR NULL". Indeed, I 
mistakenly forgot to add the "NOT NULL" when creating the table.
    * If escape_q is called, it returns FALSE.
    * Value doesn't get escaped when adding it to a query (with q << 
mysqlpp::quote << value).

I corrected the table definition and now I get the same type 25 in both 
cases.
Question remains if there is a bug in escape_q (returning false for all 
"nullable" types), or that this is caused because of a mismatch between 
database definition (allowing NULL) and SSQLS definition (not allowing 
NULL).

Thread
SSQLS with BINARY column is sometimes not escapedKemet5 May
  • Re: SSQLS with BINARY column is sometimes not escapedWarren Young6 May
    • Re: SSQLS with BINARY column is sometimes not escapedKemet6 May
    • Re: SSQLS with BINARY column is sometimes not escapedKemet8 May
      • Re: SSQLS with BINARY column is sometimes not escapedWarren Young8 May
        • SOLVED: SSQLS with BINARY column is only escaped when defined as "NOT NULL"Kemet19 May
          • Re: SOLVED: SSQLS with BINARY column is only escaped when definedas "NOT NULL"Warren Young19 May