Re: [Mysql-cocoa-users] Reading query result causes bus error
Brought to you by:
sergecohen
From: Michael T. <mta...@ap...> - 2005-04-19 08:39:06
|
Well, I tracked it a bit and found the returned array from theField = mysql_fetch_fields(mResult); does not contains the number of entries according to theNumFields = [self numOfFields]; In fact, theNumFields seem to have a proper value, theField only contains one entry 'id'. Please have a look at MCPResult.m:440. The following output shows that there is a NULL element among the resulting fields. I lost now. Does anyone have an idea? (gdb) print theField[0] $1 = { name = 0x28759a0 "id", table = 0x28759a8 "id", org_table = 0x2875990 "faqdata", db = 0x2875998 "faqdata", def = 0x2875988 "faq", length = 42424704, max_length = 0, flags = 11, decimals = 1, type = FIELD_TYPE_SHORT } Current language: auto; currently objective-c (gdb) print theField[1] $2 = { name = 0x2 <Address 0x2 out of bounds>, table = 0x7 <Address 0x7 out of bounds>, org_table = 0x7 <Address 0x7 out of bounds>, db = 0x3 <Address 0x3 out of bounds>, def = 0x3 <Address 0x3 out of bounds>, length = 0, max_length = 49667, flags = 0, decimals = 63, type = FIELD_TYPE_LONG } (gdb) print theField[2] $3 = { name = 0x28759d0 "lang", table = 0x28759d8 "lang", org_table = 0x28759c0 "faqdata", db = 0x28759c8 "faqdata", def = 0x28759b8 "faq", length = 42424752, max_length = 0, flags = 5, decimals = 2, type = FIELD_TYPE_FLOAT } Thank you, Michael Am 19.04.2005 9:32 Uhr schrieb "Michael Taubert" unter <mta...@ap...>: > Hi all, > > I tried to run the following code to query a test database and as soon as I > want to print out the description the program crash with a bus error. The > CLI_test program is crashing too when I use these login informations and the > database. > > ------------------ > Connection = [[MCPConnection alloc] initToHost:@"localhost" > withLogin: @"test" > password: @"test" > usingPort: 0]; > > if (! Connection || [Connection isConnected] == FALSE) > { > NSLog (@"Could not log into database: %@\n", [Connection > getLastErrorMessage]); > NSBeep(); > } > else > { > NSArray *Dict = nil; > MCPResult *Result = nil; > > [Connection selectDB:@"faq"]; > > if ([Connection getLastErrorID] == 0) > Result = [Connection queryString:@"select * from faqdata"]; > > if ([Connection getLastErrorID] == 0) > NSLog (@"Got: %@\n", [Result description]); > /* > * read to start queries... > */ > } > --------------- > > Any ideas? > > Thank you, > > Michael > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: New Crystal Reports XI. > Version 11 adds new functionality designed to reduce time involved in > creating, integrating, and deploying reporting solutions. Free runtime info, > new features, or free trial, at: http://www.businessobjects.com/devxi/728 > _______________________________________________ > Mysql-cocoa-users mailing list > Mys...@li... > https://lists.sourceforge.net/lists/listinfo/mysql-cocoa-users |