List:MySQL++« Previous MessageNext Message »
From:Yingbo Miao Date:August 4 2005 8:13pm
Subject:Re: Return string directly from the class ROW
View as plain text  
Hi,

I misunderstood Pal's post. Sorry again for that.

Using raw_data(), we only get a char * without knowing the length of
it. In the mysql++ example, we see some "complicate" way to get the
length. I think we can avoid it by directly returning the std::string
object. That is why I suggest the new function *raw_string()*.

- Yingbo

On 8/4/05, Yingbo Miao <yingbo@stripped> wrote:
> Oh, sorry. I copied wrong code from row.h. It should be:
> 
> const std::string & raw_string ( int i ) const {
>     return data.at(i);
> }
> 
> 
> On 8/4/05, Pål Brattberg <pal@stripped> wrote:
> > Yingbo Miao wrote:
> >  > I wonder whether it is a good way to return the "raw string" directly
> > from the class ROW. For example, one line line can be added to the row.h
> >
> > How about the following, already present i row.h?
> >
> > // Return the value of a field given its index, in raw form.
> > const char* raw_data(int i) const
> > {
> >          return data_[i].data();
> > }
> >
> > What are you missing in this?
> >
> > / pål
> >
Thread
Return string directly from the class ROWYingbo Miao4 Aug
  • Re: Return string directly from the class ROWPål Brattberg4 Aug
    • Re: Return string directly from the class ROWYingbo Miao4 Aug
      • Re: Return string directly from the class ROWYingbo Miao4 Aug
  • Re: Return string directly from the class ROWWarren Young12 Jan