Thread: [Mysql-cocoa-users] MCPConnection upgrade
Brought to you by:
sergecohen
|
From: Camille GOUREAU-S. <ca...@lu...> - 2004-08-14 21:15:34
|
Hi,
I'm thinking about an implementation of MCPConnection, but I'm afraid
to touch the framework source code.
I usually need to have a detailed report about errors after each of my
queries, so I add this code after all queries (till I'm sure they'll be
OK in any circumstances) :
if ([[connectMySQL getLastErrorMessage]
compare:@""]!=NSOrderedSame) {
NSLog (@"erreur MySQL !!");
NSLog(@"query : %@", myQueryString);
NSLog(@"error : %@", [connectMySQL getLastErrorMessage]);
}
Would it be possible (and easy to do by myself) to add a flag in
MCPConnection : BOOL errorReport
And when it's set to TRUE, to NSLog detailed reports after each error ?
Can somebody point me where to look and how to do without ruining the
code ?
Thanks.
Camille
|
|
From: Lutin L. <in...@lu...> - 2004-08-14 20:50:52
|
Hi,
I'm thinking about an implementation of MCPConnection, but I'm afraid
to touch the framework source code.
I usually need to have a detailed reporte about errors after each of my
queries, so I add these code after all queries (till I'm sure they'll
be OK in any circumstances) :
if ([[connectMySQL getLastErrorMessage]
compare:@""]!=NSOrderedSame) {
NSLog (@"erreur MySQL !!");
NSLog(@"query : %@", myQueryString);
NSLog(@"error : %@", [connectMySQL getLastErrorMessage]);
}
Would it be possible (and easy to do by myself) to add a flag in
MCPConnection : BOOL errorReport
And when it's set to TRUE, to NSLog detyailed reports after each error ?
Can somebody point me where to look and how to do without ruining the
code ?
Thanks.
Camille
|
|
From: Serge C. <ser...@us...> - 2004-08-16 06:36:02
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi there;=0D
=0D
I'm a bit surprised by your mail.=0D
In the current version of SMySQL I'm using I have a NSLog call if an =0D
error is produced during a connection query...=0D
=0D
Indeed the code at lines 501 and following from MCPConnection.m are =0D
doing more or less what you are doing yourself.=0D
=0D
By the way, I don't know if using [[connectMySQL getLastErrorMessage] =0D=
compare:@""]!=3DNSOrderedSame is a proper way of checking for error in =0D=
the last query. If it is really necessary, I can add a **BOOL argument =0D=
to know if an error occured (the best would be indeed a **unsigned int, =0D=
to get back the mysql_query return code (theQueryCode in my source)).=0D
=0D
What do people think about this change to the API (providing nil as the =0D=
**unsigned int will avoid the need for having a correct reference to an =0D=
unsigned int).=0D
=0D
Serge.=0D
=0D
PS: If users are interested, that can go in 3.0, hopefully coming not =0D=
too late now.=0D
=0D
Le 14 ao=FBt 04, =E0 15:52, Lutin Ludique a =E9crit :=0D
=0D
> Hi,=0D
>=0D
> I'm thinking about an implementation of MCPConnection, but I'm afraid =0D=
> to touch the framework source code.=0D
> I usually need to have a detailed reporte about errors after each of =0D=
> my queries, so I add these code after all queries (till I'm sure =0D
> they'll be OK in any circumstances) :=0D
>=0D
> if ([[connectMySQL getLastErrorMessage] =0D
> compare:@""]!=3DNSOrderedSame) {=0D
> NSLog (@"erreur MySQL !!");=0D
> NSLog(@"query : %@", myQueryString);=0D
> NSLog(@"error : %@", [connectMySQL getLastErrorMessage]);=0D
> }=0D
>=0D
> Would it be possible (and easy to do by myself) to add a flag in =0D
> MCPConnection : BOOL errorReport=0D
> And when it's set to TRUE, to NSLog detyailed reports after each error =
=0D
> ?=0D
>=0D
> Can somebody point me where to look and how to do without ruining the =0D=
> code ?=0D
>=0D
> Thanks.=0D
>=0D
> Camille=0D
>=0D
>=0D
>=0D
> -------------------------------------------------------=0D
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media=0D=
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33=0D
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.=0D
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285=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: 9CBB58FB=0D
*******************************************=0D
=0D
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)
iD8DBQFBIFXF5EPeG5y7WPsRAgRfAKCkZWNLKH27HSqZTJGDVGqk85bLhACeJ4lH
b8vIUQHmT0pE8xt8r5QUyH0=3D
=3DiDJW
-----END PGP SIGNATURE-----
|
|
From: Aaron J. <aj...@ed...> - 2004-08-16 12:19:52
Attachments:
PGP.sig
|
Serge,
If you do this, please continue to provide the "classic" version of the=20=
method so that the unsigned int reference is not required to be used. =20=
I'm fine with using if ([connection getLastErrorID]) to see if there's=20=
an error.
Aaron
On Aug 16, 2004, at 1:35 AM, Serge Cohen wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi there;
>
> I'm a bit surprised by your mail.
> In the current version of SMySQL I'm using I have a NSLog call if an=20=
> error is produced during a connection query...
>
> Indeed the code at lines 501 and following from MCPConnection.m are=20
> doing more or less what you are doing yourself.
>
> By the way, I don't know if using [[connectMySQL getLastErrorMessage]=20=
> compare:@""]!=3DNSOrderedSame is a proper way of checking for error in=20=
> the last query. If it is really necessary, I can add a **BOOL argument=20=
> to know if an error occured (the best would be indeed a **unsigned=20
> int, to get back the mysql_query return code (theQueryCode in my=20
> source)).
>
> What do people think about this change to the API (providing nil as=20
> the **unsigned int will avoid the need for having a correct reference=20=
> to an unsigned int).
>
> Serge.
>
> PS: If users are interested, that can go in 3.0, hopefully coming not=20=
> too late now.
>
> Le 14 ao=FBt 04, =E0 15:52, Lutin Ludique a =E9crit :
>
>> Hi,
>>
>> I'm thinking about an implementation of MCPConnection, but I'm afraid=20=
>> to touch the framework source code.
>> I usually need to have a detailed reporte about errors after each of=20=
>> my queries, so I add these code after all queries (till I'm sure=20
>> they'll be OK in any circumstances) :
>>
>> if ([[connectMySQL getLastErrorMessage]=20
>> compare:@""]!=3DNSOrderedSame) {
>> NSLog (@"erreur MySQL !!");
>> NSLog(@"query : %@", myQueryString);
>> NSLog(@"error : %@", [connectMySQL getLastErrorMessage]);
>> }
>>
>> Would it be possible (and easy to do by myself) to add a flag in=20
>> MCPConnection : BOOL errorReport
>> And when it's set to TRUE, to NSLog detyailed reports after each=20
>> error ?
>>
>> Can somebody point me where to look and how to do without ruining the=20=
>> code ?
>>
>> Thanks.
>>
>> Camille
>>
>>
>>
>> -------------------------------------------------------
>> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank =
Media
>> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
>> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
>> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
>> _______________________________________________
>> Mysql-cocoa-users mailing list
>> Mys...@li...
>> https://lists.sourceforge.net/lists/listinfo/mysql-cocoa-users
>>
>>
> *******************************************
> Serge Cohen
>
> GPG Key ID: 9CBB58FB
> *******************************************
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (Darwin)
>
> iD8DBQFBIFXF5EPeG5y7WPsRAgRfAKCkZWNLKH27HSqZTJGDVGqk85bLhACeJ4lH
> b8vIUQHmT0pE8xt8r5QUyH0=3D
> =3DiDJW
> -----END PGP SIGNATURE-----
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> _______________________________________________
> Mysql-cocoa-users mailing list
> Mys...@li...
> https://lists.sourceforge.net/lists/listinfo/mysql-cocoa-users
|
|
From: Camille GOUREAU-S. <ca...@lu...> - 2004-08-16 13:57:38
|
Hi all, it seems that i've got a problem with the framework. With a trivial error in my code hre's what the frameworks tells via the console : 2004-08-16 15:54:58.041 LLCaisse[623] Problem in queryString error code is : -1, query is : select ERRORid from lulu.stock where codebarre = "8712269354009" ; -in ObjC : select ERRORid from lulu.stock where codebarre = "8712269354009" ;- and with my code : 2004-08-16 15:54:58.042 LLCaisse[623] erreur MySQL !! 2004-08-16 15:54:58.042 LLCaisse[623] query : select ERRORid from lulu.stock where codebarre = "8712269354009" ; 2004-08-16 15:54:58.042 LLCaisse[623] error : Unknown column 'ERRORid' in 'field list' Here, the error is rather trivial, but in somewhat complex query, it helps me to have the error message from mySQL (third line of my report). So I've perhaps forgot something, but I find a (my) complete report usefull. BTW, if I'm the only one to ask for this, just forget it. I'm sure you have more important things to do. in any way, thanks for your work, I couldn't work without roue framework. Camille |
|
From: Camille GOUREAU-S. <ca...@lu...> - 2004-08-16 14:30:58
|
Hi, > Are you sure there's no line after that? Yeah. I usually don't bother to (badly) do something when it is (well) done by somebody else. ;) > That's basically the exact same thing that you use in your error > reporting code. It's why I think I probably have a problem. > If the second line is not there, what version of the framework are you > using? 2.2.1d1 > Have you modified it in any way? I don't think so. In any way don't bother with that. it seems that I'm the only one with this problem. There is no need to loose your time. Thanks. Camille |
|
From: Aaron J. <aj...@ed...> - 2004-08-16 14:33:09
Attachments:
PGP.sig
|
Why not get the latest version of the framework? On Aug 16, 2004, at 9:32 AM, Camille GOUREAU-SUIGNARD wrote: > Hi, > >> Are you sure there's no line after that? > Yeah. I usually don't bother to (badly) do something when it is (well) > done by somebody else. ;) > >> That's basically the exact same thing that you use in your error >> reporting code. > It's why I think I probably have a problem. >> If the second line is not there, what version of the framework are >> you using? > 2.2.1d1 > >> Have you modified it in any way? > I don't think so. > > In any way don't bother with that. it seems that I'm the only one with > this problem. There is no need to loose your time. > > Thanks. > > Camille > |
|
From: Camille GOUREAU-S. <ca...@lu...> - 2004-08-16 14:36:32
|
Hi (again) :) > Why not get the latest version of the framework? Because I didn't think I had a use for the new imrovements : - - unsigned integer (up to UNSIGNED BIGGINT, included). - - retrieve TEXT columns as NSString (not NSData anymore). - - a new method quoteObject (from MCPConnection), quoting object into a suitable way for use with MySQL (deciding the type of quoting from the class of the object). But I'll get it ASAP. Many thanks. Camille |
|
From: Aaron J. <aj...@ed...> - 2004-08-15 01:52:30
Attachments:
PGP.sig
|
A couple of points. First, it looks like MCPConnection already does
this. From MCPConnection.m, in the queryString: method:
NSLog (@"Problem in queryString error code is : %d, query is :
%s -in ObjC : %@-\n", theQueryCode, theCQuery, query);
NSLog(@"Error message is : %@\n", [self getLastErrorMessage]);
// theResult = [theResult init]; // Old version...
theResult = nil;
Whenever I have an error, I get that output on the console.
Second, it seems like it would be much quicker to check for errors in
your code like this:
if ([connection getLastErrorID])
That just checks for a non-zero error ID, which I think will be much
faster than doing a string compare each time. That's how I do it in my
code.
Aaron
On Aug 14, 2004, at 4:17 PM, Camille GOUREAU-SUIGNARD wrote:
> Hi,
>
> I'm thinking about an implementation of MCPConnection, but I'm afraid
> to touch the framework source code.
> I usually need to have a detailed report about errors after each of my
> queries, so I add this code after all queries (till I'm sure they'll
> be OK in any circumstances) :
>
> if ([[connectMySQL getLastErrorMessage]
> compare:@""]!=NSOrderedSame) {
> NSLog (@"erreur MySQL !!");
> NSLog(@"query : %@", myQueryString);
> NSLog(@"error : %@", [connectMySQL getLastErrorMessage]);
> }
>
> Would it be possible (and easy to do by myself) to add a flag in
> MCPConnection : BOOL errorReport
> And when it's set to TRUE, to NSLog detailed reports after each error ?
>
> Can somebody point me where to look and how to do without ruining the
> code ?
>
> Thanks.
>
> Camille
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> _______________________________________________
> Mysql-cocoa-users mailing list
> Mys...@li...
> https://lists.sourceforge.net/lists/listinfo/mysql-cocoa-users
|