List:MySQL++« Previous MessageNext Message »
From:Ankur G35 Saxena Date:November 20 2006 8:14pm
Subject:Re: Storing BLOB using C constructs and no STL(string, streams etc)
View as plain text  
On 11/20/06, Warren Young <mysqlpp@stripped> wrote:
> Ankur G35 Saxena wrote:
> >
> > I need help in convertin this piece of code in C strings rather than
> > streams and strings. can someone please help me out with the use of
> > escape in char*.
> >
> > c_struct is a C structure with some char buffers and int values.
> >
> > string fill((char*)c_struct, len);
>
> This is very poor practice.  It will break if you:
>
> - change certain compiler options
>
> - change compiler vendors
>
> - change CPU types (including 32-bit to 64-bit)
>
> - use different compilers or build options on multiple machines
> accessing the same database
>
> - change the slightest thing about the definition of c_struct
>
> This code is crying out for c_struct to be a SSQLS.  Then the "how"
> becomes obvious.
>
> --
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:    http://lists.mysql.com/plusplus?unsub=1
>
>


Ok fine I agree, now if this was an image I was trying to read of the
FS, then what? its a char buffer, now how do I put this in query
without having to create a string? Some piece of code, assuming I have
a buffer called img_buf which is char[4096] that I want to put in?

Thanks
Thread
Storing BLOB using C constructs and no STL(string, streams etc)Ankur G35 Saxena19 Nov
  • Re: Storing BLOB using C constructs and no STL(string, streams etc)Warren Young20 Nov
    • Re: Storing BLOB using C constructs and no STL(string, streams etc)Ankur G35 Saxena20 Nov
      • Re: Storing BLOB using C constructs and no STL(string, streams etc)Warren Young20 Nov