Re: [Mysql-cocoa-users] Hello! Anybody?
Brought to you by:
sergecohen
|
From: Lorenz T. <lor...@gm...> - 2003-11-21 09:53:07
|
Hi,
Try something like the following to get the binary data:
imageData =3D [[NSData alloc] initWithContentsOfFile:fileName];
Then write it to the db like you have written:
sql =3D [NSString stringWithFormat:@"insert into fota (foto) values=20
('%@');",[conn prepareBinaryData:imageData]];
Regards,
Lorenz
On Wednesday, Nov 19, 2003, at 05:13 Europe/Rome,=20
mys...@li... wrote:
> To: mys...@li...
> From: leszek <le...@ev...>
> Date: Tue, 18 Nov 2003 23:32:46 +0100
> Subject: [Mysql-cocoa-users] Hello! Anybody?
>
> Hi,
> I'm writing COCOA app with SmySQL and I need to store some JPEGS in
> blob field.
> I tried this code:
> (...)
> mini =3D [bitmap representationUsingType:NSJPEGFileType =
properties:nil];
> (...)
> if ([conn isConnected]) {
> [conn selectDB:@"test"];
> sql =3D [NSString stringWithFormat:@"insert into fota (foto)
> values ('%@');",[conn prepareBinaryData:mini]];
> [polaczenie queryString:sql];
>
> ...and data looks truncated (bad Huffman code - says mysql).
>
> What's is going wrong? Data in 'mini' are correct - test procedure can
> render image in ImageView - from database - no way!
>
> Any help will be appreciated.
>
> regards
> Leszek Nie
>
>
>
>
> --__--__--
--=20
lorenz textor
** sh **
eigerstrasse 21
8200 schaffhausen
tf 052 - 624 27 91
** zh **
schimmelstrasse 5
8003 z=FCrich
tf 043 - 333 00 19
**
mobile 076 - 531 71 74
email lo...@te...
|