Re: [Mysql-cocoa-users] NSImage problem
Brought to you by:
sergecohen
From: Max F. <ins...@ma...> - 2007-01-07 17:33:56
|
If everything else works but longblobs, more than likely you simply need to increase your max packet size in your mysql cnf file. http://www.vbulletin.com/forum/showthread.php?t=103786 -Max On Jan 7, 2007, at 3:40 AM, Eric VERDIN wrote: > Hi, > > i use the new version of the framework (3.01) to store int, > varchar, float and text without problem. > But i can't insert an image in a longblob. > > I have an 2006 Error (MySQL server has gone away) with 4.1.22 or > 5.0.27 version. > > **************************************** > > #import <Cocoa/Cocoa.h> > #import <Foundation/Foundation.h> > #import <MCPKit_bundled/MCPResult.h> > #import <MCPKit_bundled/MCPConnection.h> > > int main(int argc, char *argv[]) > { > > NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; > MCPConnection *connection; > MCPResult *result; > NSImage *image; > NSData *tiffData; > NSString *string; > NSString *query; > NSString *nomFichier; > int erreur; > NSString *message; > > nomFichier = [[NSString alloc] initWithString:@"~/Pictures/ > Berlan_1.png"]; > nomFichier = [nomFichier stringByExpandingTildeInPath]; > image = [[NSImage alloc] initWithContentsOfFile:nomFichier]; > tiffData = [image TIFFRepresentation]; > > connection = [[MCPConnection alloc] initToHost:@"localhost" > withLogin:@"" password:@"" usingPort:0]; > if (connection != nil) > { > > [connection selectDB:@"test_image"]; > > string = [connection prepareBinaryData:tiffData]; > query = [[NSString alloc] initWithFormat:@"Insert into %@ (%@) > VALUES ('%@');", > @"nomTable", > @"nomColonne", > tiffData]; > > result = [connection queryString:query]; > erreur = [connection getLastErrorID]; > message = [connection getLastErrorMessage]; > > [connection release]; > [nomFichier release]; > [query release]; > [image release]; > [tiffData release]; > > } > > [pool release]; > return 0; > > } > > **************************************** > > Thank you in advance for your help, > > Eric > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV________________________________ > _______________ > Mysql-cocoa-users mailing list > Mys...@li... > https://lists.sourceforge.net/lists/listinfo/mysql-cocoa-users |