Re: [Mysql-cocoa-users] Blob ?
Brought to you by:
sergecohen
From: John G. <jo...@jl...> - 2003-05-22 15:04:55
|
Sorry for the delay in getting back on this, I replied to a similar question a while ago, but basically if the column texte is in fact a BLOB, then what you will get back from the query is NOT an NSString, but an NSData object. If you know that the NSData object actually contains string data then you can extract a string from it using the raw data with an encoding as below NSData* contentRawBlob = [lineRes objectForKey:@"value"]; NSString* contentText = [[NSString alloc] initWithData:contentRawBlob encoding:NSASCIIStringEncoding]; Hope this helps JOhn On Tuesday, May 20, 2003, at 05:38 AM, Camille Goureau-Suignard wrote: > Hi, > > did anybody manage to retrieve a blob ? > > with string : "marotte ange" > chaine2 = [NSString stringWithFormat: @"insert commentlong > (texte) values (\"%@\") ;", [cnxCommentaireLong stringValue]] ; > > it gives in MySQL : > mysql> select * from commentlong ; > +----+--------------+ > | id | texte | > +----+--------------+ > | 1 | marotte ange | > +----+--------------+ > 1 row in set (0.05 sec) > > But when retrieving it it gives : > SMySQLResult *result2 = [connectMySQL queryString: > [NSString stringWithFormat: @"select texte from commentlong where id = > %@ ;",[ligne objectForKey: @"id_commentlong"]]] ; > [cnxCommentaireLong setStringValue: [[result2 > fetchRowAsDictionary] objectForKey: @"texte"]] ; > > <6d61726f 74746520 616e6765 > > > any idea ? > > Thanks. > > Camille > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ObjectStore. > If flattening out C++ or Java code to make your application fit in a > relational database is painful, don't do it! Check out ObjectStore. > Now part of Progress Software. http://www.objectstore.net/sourceforge > _______________________________________________ > Mysql-cocoa-users mailing list > Mys...@li... > https://lists.sourceforge.net/lists/listinfo/mysql-cocoa-users > |