[Mysql-cocoa-users] Problem with the size of results
Brought to you by:
sergecohen
|
From: Jerome R. <jer...@fn...> - 2002-05-27 14:28:29
|
Hello,
I'm trying to use the framework, but it seems that I have a problem=20
with the size of my results. Here is the source I use (taken from the=20
test example).
----------
NSAutoreleasePool *pool =3D [[NSAutoreleasePool alloc] init];
SMySQLConnection *connection;
SMySQLResult *result;
NSArray *names, *types;
NSDictionary *row;
unsigned int count, i;=09
unsigned int compteur;=09
connection =3D [[SMySQLConnection alloc] initToHost:@"localhost"=20
withLogin:@"root" password:@"Typhon00" usingPort:0];
[connection selectDB:@"mysql"];
result =3D [connection queryString:@"select * from PERSONNE where=20=
NOM=3D\"RABAS\" and PRENOM=3D\"GILLES\""];
count =3D [result numOfFields];
names =3D [result fetchFieldsName];
types =3D [result fetchTypesAsArray];
for (i=3D0; i<count; i++) {
NSLog(@" Column : %d of type : %@ has for name : %@\n", (i+1),=20=
[types objectAtIndex:i], [names objectAtIndex:i]);
}
compteur =3D [result numOfRows];
NSLog (@"Number of rows : %d", compteur);
while (row =3D [result fetchRowAsDictionary]) {
for (i=3D0; i<count; i++)
{
NSString *name =3D [names objectAtIndex:i];
NSLog(@"%@ : %@\n", name, [row objectForKey:name]);
if ([result isBlobAtIndex:i]) {
NSString *theString =3D [result =
stringWithCString:[[row=20
objectForKey:name] bytes]];
NSLog(@" as string : %@\n",theString);
}
}
}
----------
If I use this select statement, names of fields are correctly displayed,=20=
the number of rows is 4820 and there are not displayed. Instead I have=20=
the following error:
*** -[NSCFDictionary setObject:forKey:]: attempt to insert nil =
value
If I modify the select statement by adding where NOM=3D\"RABAS\" and=20
PRENOM=3D\"GILLES\", there is only 2 rows and everything is correctly=20
displayed (names of field, number of rows, content of rows).
Does anybody get the same problem?
Thanks.
J=E9r=F4me Rabas.
|