List:MySQL++« Previous MessageNext Message »
From:Alex Burton Date:July 21 2006 7:33am
Subject:Bug in const ColData Row::at(size_type i) const
View as plain text  
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
Thread
Bug in const ColData Row::at(size_type i) constAlex Burton21 Jul
  • Re: Bug in const ColData Row::at(size_type i) constWarren Young21 Jul
    • Bug in mysqlpp::transactionAlex Burton31 Aug
      • Re: Bug in mysqlpp::transactionWarren Young12 Jan