List:MySQL++« Previous MessageNext Message »
From:Jay Sprenkle Date:July 14 2011 11:38am
Subject:Re: update fails... any suggestions?
View as plain text  
I looked at the produced sql last night after getting an error that the
escaped string was too long for the column.
After looking at the mysql docs on binary escaping I was going to try this
next:

         std::string str( data, sizeof(data) );
         std::ostringstream os( str );
         os << std::hex << std::uppercase << str;
         std::string hexData( os.str() );

         mysqlpp::Query query = conn.query();
         query
            << "UPDATE customer SET "
            << " Data=0x" << mysqlpp::quote << hexData //mysqlpp::escape
<<
mysqlpp::sql_blob( data, sizeof(data) )
            << ", AccountName=" <<  mysqlpp::quote <<
widget.AccountName->text().toStdString()
            << ", Active=" << mysqlpp::sql_bool(
widget.ActiveCheckBox->checkState() == Qt::Checked ? 1 : 0 )
            << " WHERE CustomerId=" << mysqlpp::sql_int( CustomerId )
            ;
         std::string sql = query.str();

I found last night that the ios::hex manipulator is not compatible with
mysql++ query streams.


On Thu, Jul 14, 2011 at 4:23 AM, Warren Young <mysqlpp@stripped> wrote:

> On Jul 14, 2011, at 12:20 AM, Kemet wrote:
>
> > Once you have this in place, everything works great !
>
> I'm not certain this is the same thing.  The OP isn't using SSQLS and
> sql_blob already is "NOT NULL".
> --
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:
> http://lists.mysql.com/plusplus?unsub=1
>
>


-- 
---
"There's a zombie outbreak!  Oh, no, wait a second...  It's just a bunch of
kids texting."

Thread
update fails... any suggestions?Jay Sprenkle13 Jul
  • Re: update fails... any suggestions?Warren Young13 Jul
    • Re: update fails... any suggestions?Jay Sprenkle13 Jul
      • Re: update fails... any suggestions?Warren Young13 Jul
        • Re: update fails... any suggestions?Warren Young13 Jul
        • Re: update fails... any suggestions?Jay Sprenkle13 Jul
          • Re: update fails... any suggestions?Kemet14 Jul
            • Re: update fails... any suggestions?Warren Young14 Jul
              • Re: update fails... any suggestions?Jay Sprenkle14 Jul
                • Re: update fails... any suggestions?Jay Sprenkle14 Jul
                  • Re: update fails... any suggestions?Jay Sprenkle14 Jul
                    • Re: update fails... any suggestions?Jay Sprenkle14 Jul
                      • Re: update fails... any suggestions?Warren Young15 Jul
                        • Re: update fails... any suggestions?Jay Sprenkle15 Jul