List:MySQL++« Previous MessageNext Message »
From:Philippe Dirkse Date:March 14 2007 8:17pm
Subject:Why does ColData need two strings for the same data?
View as plain text  
Hi,

wandering through the mysql++ source looking for why accessing blob data threw exceptions
(which has nothing further to do with this message) I noticed the ColData template
copying the 'c' string data passed to it during construction twice: once into itself (as
a derivate from std::string) as the 'entire' buffer (so using the std::string(char*, int)
constructor) but then also into a member std::string buf_ which only copies the contents
till the first '\0' encountered. Is this really necessary? I can understand why you want
to make a copy of the data, but twice?

Another small suggestion/request: is it possible to add the function 'Row::raw_data(char*
fieldName) to the Row class as a convenience function? Why support it for operator[]
only? After searching the source I found that using
raw_data(theRow.parent().field_num(fieldName)) also does the trick but give us some more
(syntactic) sugar!!!

Regards,

Philippe
Thread
Why does ColData need two strings for the same data?Philippe Dirkse14 Mar
  • Re: Why does ColData need two strings for the same data?Warren Young15 Mar
  • Re: Why does ColData need two strings for the same data?Philippe Dirkse16 Mar
    • Re: Why does ColData need two strings for the same data?Warren Young17 Mar