dbTalk Databases Forums  

Bug in const ColData Row::at(size_type i) const

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Bug in const ColData Row::at(size_type i) const in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Bug in const ColData Row::at(size_type i) const - 07-21-2006 , 02:35 AM






Hi all,

I have traced a problem with blobs to this function
const ColData Row::at(size_type i) const

In this function, A ColData object is constructed from c_str() of the fields data.
When the fields data contains a null character, the resulting ColData object will not contain the entire data of the field.

The problem is that ColData expects to be able to be constructed given a pointer to characters. It needs a length too because valid data can contain a null character.

There is no way to access the full data in this situation.
This function
const char* raw_data(int i) const
can let you access the data but you don't know how long it is.

I have made the following modification:

Added this to Row :

const std::string & raw_string(int i) const
{
return data_[i];
}

This solves my problem, for the moment but doesn't fix the problem,
All of the functions that return ColData from Row have truncated data.

Alex

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: Bug in const ColData Row::at(size_type i) const - 07-21-2006 , 07:12 AM






Alex Burton wrote:
Quote:
I have traced a problem with blobs to this function
const ColData Row::at(size_type i) const
We're aware of a whole class of problems in this area. The biggest
substantive change in the next version (whenever that happens) will be
to fix these problems.

See the current Wishlist (not the one in your tarball!) if you want to
help make that day come quicker by contributing patches:

http://svn.gna.org/viewcvs/mysqlpp/t...st?view=markup

Quote:
I have made the following modification:

Added this to Row :

const std::string & raw_string(int i) const
{
return data_[i];
}

This solves my problem, for the moment but doesn't fix the problem,
All of the functions that return ColData from Row have truncated data.
The proper fix probably involves adding another ctor to ColData that
takes a length in addition to a char* and making the various parts of
the code use it. Note that you can't just add the length parameter to
the existing ctor, or you'll break the ABI.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.