Re: [Mysql-cocoa-users] numOfRows
Brought to you by:
sergecohen
From: Serge C. <co...@em...> - 2002-05-23 09:52:23
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello Camille;=0D =0D I guess the problem comes from the type of the result of [result =0D numOfRows] is my_ulonglong where as %d in the string waits for an int. =0D= Try :=0D NSLog (@"numOfRows : %d", (int)[result numOfRows])=0D =0D (that's a guess, don't take it for sure, and by the way I'd be =0D interested in the issue).=0D =0D just one remark:=0D in the line : NSLog (@"query : %@",chaine) ; chaine is obviously of type = =0D NSString*=0D in the line : chaine =3D [result fetchRowAsDictionary] ; chaine is now = of =0D type NSDictionary*=0D =0D I guess you have decalred chaine as type id, which fits both object =0D pointers, but you'd better of having different names still.=0D =0D =0D Serge.=0D =0D Le mercredi 22 mai 2002, =C3=A0 10:25 PM, Famille GOUREAU-SUIGNARD a = =C3=A9crit :=0D =0D > Hi,=0D >=0D > does anybody wish to solve a new problem ? (many thanks to Serge for =0D= > previous one :) )=0D >=0D > Here is the software :=0D >=0D > NSLog (@"query : %@",chaine) ; = // present the query=0D > result =3D [connection queryString: chaine]; = // send the query=0D > NSLog (@"numOfRows : %d", [result numOfRows]) ; // should give = the =0D > number of rows matching the query=0D > while (chaine =3D [result fetchRowAsDictionary]) // This = loop =0D > will test for every row in the query up to the last one=0D > {=0D > NSLog(@"descriptif : %@\n", [chaine objectForKey: @"descriptif"]);=0D= > compteurI++ ;=0D > }=0D > NSLog (@"nombre d'enreg correspondants : %d", compteurI) ; //How = many =0D > rows are in the response=0D > NSLog(@"descriptif : %@\n", [chaine objectForKey: @"descriptif"]);=0D >=0D > And here is the result :=0D >=0D > 2002-05-22 22:19:17.860 Gestionnaire stock[989] query : select =0D > descriptif, fournisseur from stock where reference like 'M07%' and =0D > fournisseur =3D 'ABC' ;=0D > 2002-05-22 22:19:17.909 Gestionnaire stock[989] numOfRows : 0=0D > 2002-05-22 22:19:17.910 Gestionnaire stock[989] descriptif : =0D > Marionnette chat gri=0D > 2002-05-22 22:19:17.910 Gestionnaire stock[989] descriptif : =0D > Marionnette chat noi=0D > 2002-05-22 22:19:17.910 Gestionnaire stock[989] nombre d'enreg =0D > correspondants : 2=0D > 2002-05-22 22:19:17.911 Gestionnaire stock[989] descriptif : (null)=0D >=0D > The problem is that a result contain X rows (attested by "nombre =0D > d'enreg correspondants : 2" and by a manual test under unix terminal) =0D= > and that the numOfRows function always reply by a 0.=0D >=0D > An idea ?=0D >=0D > Thanks.=0D >=0D > Camille=0D >=0D >=0D > _______________________________________________________________=0D >=0D > Don't miss the 2002 Sprint PCS Application Developer's Conference=0D > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm=0D= >=0D > _______________________________________________=0D > Mysql-cocoa-users mailing list=0D > Mys...@li...=0D > https://lists.sourceforge.net/lists/listinfo/mysql-cocoa-users=0D >=0D >=0D - ----------------------------------------------------=0D Serge Cohen=0D =0D GPG Key ID: 1024D/69B1D346=0D - ----------------------------------------------------=0D -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (Darwin) Comment: For info see http://www.gnupg.org iD8DBQE87Lx5Mygj1Wmx00YRAtFtAKCNKJb6ErX7GqdvOtL6gtUrXKo2yQCeJzZg 1aWeS1wj/5rpVdWKHTebjq8=3D =3DUOxY -----END PGP SIGNATURE----- |