List:MySQL++« Previous MessageNext Message »
From:Jay Sprenkle Date:July 13 2011 8:04pm
Subject:update fails... any suggestions?
View as plain text  
Good afternoon,

I'm a new user of mysql++ looking for some pointers (pun intended).

The problem is my update statement fails.

The connection is open. The previous statement that uses the connection
works.
I'm sure the record I'm trying to update exists. I can see it with the mysql
query tools.
I'm sure CustomerId is correct.

         // declaration of the customer id
         uint32_t CustomerId;

Why does this fail to update?

         mysqlpp::Query query = conn.query( "UPDATE customer SET
AccountName=%2q, Active=%3, Password=%1 WHERE CustomerId=%0" );
         query.parse();
         mysqlpp::SQLQueryParms parms;
         parms.push_back( mysqlpp::sql_int( CustomerId ) );
         parms.push_back( mysqlpp::sql_blob( data, sizeof(data) ) ); //<- 16
byte binary blob
         parms.push_back( mysqlpp::sql_varchar(
widget.AccountName->text().toAscii().data() ) );  // string
         parms.push_back( mysqlpp::sql_bool(
widget.ActiveCheckBox->checkState() == Qt::Checked ? 1 : 0 ) );  //
         mysqlpp::SimpleResult res = query.execute( parms );


If I turn off exceptions for the connection it fails silently (the
result.info() method returns nothing).
if I turn exceptions on it seg faults here when trying to convert to a
string:

std::string Query::str(SQLQueryParms& p)
{
if (!parse_elems_.empty()) {
proc(p);
}

return sbuffer_.str();
}

Thanks

-- 
---
"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