Thread: [Mysql-cocoa-users] Re: My App
Brought to you by:
sergecohen
|
From: John G. <jo...@jl...> - 2003-09-26 09:27:06
|
no problem :)
would be worth forwarding this on to the list (which I have done now
anyway).
then let serge have your app code to look at.
There IS an init method by the way, just that it doesn't seem to be
initialising the encoding variable (internal to the framework)
JOhn
On Friday, September 26, 2003, at 12:25 AM, Ezat Hashim wrote:
> You were absolutely right! Thanks!
>
> The app bombed because (I guess) there is no 'init' method per se. I
> have made the changes as you suggested and things seem to be working
> now. Do you think that I should ask Serge to look at his 'init' to see
> what went wrong (I assume there is an init).?
>
>
> On Thursday, September 25, 2003, at 08:05 AM, John Guy wrote:
>
>> Hiya,
>>
>> had a very quick look, can't see anything that looks obviously wrong.
>>
>> I am a little busy, and also I just realised I am still using the
>> older version of the framework so I can't compile your code :(
>>
>> BUT
>>
>> I have noticed that you are doing a very simple
>> dbQuery=[[MCPConnection alloc] init];
>> in your DataController init method.
>>
>> Looking at the documentation it implies that you wouldn't normally
>> use a simple init, so maybe there is some problem in the Framework.
>>
>> This is the code I always use when setting up my connections etc.
>>
>> -(bool)loginToServer:(NSString*)server
>> user:(NSString*)user
>> password:(NSString*)pass
>> selectDatabase:(NSString*)db
>> {
>> if (dbConnection = [[MCPConnection alloc]
>> initToHost:server withLogin:user password:pass usingPort:0])
>> {
>> if ([dbConnection selectDB:db])
>> {
>> loggedIn = TRUE;
>> return(TRUE);
>> }
>> }
>> //TODO setting loggedIn may be redundent since a valid dbConnection
>> object
>> // means the same
>> loggedIn = FALSE;
>> return(FALSE);
>> } // loginToServer()
>>
>> as you can see I use the initToHost methods which I think Serge has
>> been using in his examples originally. So maybe this is setting up
>> the encoding better (again I haven't got the time to check the
>> Framework source code at the moment - sorry).
>>
>> Why not try using the initToHost method and see if this fixes you
>> problem.
>> Easiest way to check is change your
>> dbQuery=[[MCPConnection alloc] init];
>> to
>> dbQuery= [MCPConnection alloc];
>>
>> in the DataController init method
>>
>> then use the initToHost method in your establishConnectionToServer:
>> method in place of the call to connectWithLogin.
>>
>> hope this helps, also out of interest which method were you in when
>> you got the error exception in your debugger (which of your methods?)
>> this may help tell Serge which method was bombing out
>>
>> let me know how you get on.
>>
>> JOhn
>>
>>
>> On Thursday, September 25, 2003, at 11:46 AM, Ezat Hashim wrote:
>>
>>> Gee Thanks! I have attached my small app.
>>> <SMySQLTester.2.tar.gz>
>>> On Thursday, September 25, 2003, at 05:42 AM, John Guy wrote:
>>>
>>
>> |
|
From: Serge C. <ser...@us...> - 2003-09-26 18:17:01
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi;
I realise now what the problem is. The framework provides a init (with=20=
NO argument) method, so that you can have an object inited and use it=20
only later (using the connectTo:... method).
As I never used this method myself, I never realise that it got broken=20=
at some point (it is not using the same mysql API function to get the=20
encoding used).
Indeed, I think that I have documented a bit the method, saying it is=20
there so that one can set 'special' features for the connection BEFORE=20=
doing the connection... but I never needed such things, and never got a=20=
feature request, so it happily stayed in the TODO queue without moving=20=
further at any time. This is going to change as I want to provide the=20
possibility to use SSL for connecting to the DB server.
In short: You found a bug, thanks a lot for reporting it. I'll try to=20
fix it soon, in the mean time the easiest for you is to use John's tip.
I also realise that I have to make the corresponding part of the=20
documentation more clear.
Thanks again (Ezat & John), for pointing the bug to me.
Serge.
Le vendredi, 26 sep 2003, =E0 11:28 Europe/Amsterdam, John Guy a =E9crit =
:
> no problem :)
>
> would be worth forwarding this on to the list (which I have done now=20=
> anyway).
>
> then let serge have your app code to look at.
>
> There IS an init method by the way, just that it doesn't seem to be=20
> initialising the encoding variable (internal to the framework)
>
> JOhn
>
> On Friday, September 26, 2003, at 12:25 AM, Ezat Hashim wrote:
>
>> You were absolutely right! Thanks!
>>
>> The app bombed because (I guess) there is no 'init' method per se. I=20=
>> have made the changes as you suggested and things seem to be working=20=
>> now. Do you think that I should ask Serge to look at his 'init' to=20
>> see what went wrong (I assume there is an init).?
>>
>>
>> On Thursday, September 25, 2003, at 08:05 AM, John Guy wrote:
>>
>>> Hiya,
>>>
>>> had a very quick look, can't see anything that looks obviously =
wrong.
>>>
>>> I am a little busy, and also I just realised I am still using the=20
>>> older version of the framework so I can't compile your code :(
>>>
>>> BUT
>>>
>>> I have noticed that you are doing a very simple
>>> dbQuery=3D[[MCPConnection alloc] init];
>>> in your DataController init method.
>>>
>>> Looking at the documentation it implies that you wouldn't normally=20=
>>> use a simple init, so maybe there is some problem in the Framework.
>>>
>>> This is the code I always use when setting up my connections etc.
>>>
>>> -(bool)loginToServer:(NSString*)server
>>> user:(NSString*)user
>>> password:(NSString*)pass
>>> selectDatabase:(NSString*)db
>>> {
>>> if (dbConnection =3D [[MCPConnection alloc]
>>> initToHost:server withLogin:user password:pass usingPort:0])
>>> {
>>> if ([dbConnection selectDB:db])
>>> {
>>> loggedIn =3D TRUE;
>>> return(TRUE);
>>> }
>>> }
>>> //TODO setting loggedIn may be redundent since a valid dbConnection=20=
>>> object
>>> // means the same
>>> loggedIn =3D FALSE;
>>> return(FALSE);
>>> } // loginToServer()
>>>
>>> as you can see I use the initToHost methods which I think Serge has=20=
>>> been using in his examples originally. So maybe this is setting up=20=
>>> the encoding better (again I haven't got the time to check the=20
>>> Framework source code at the moment - sorry).
>>>
>>> Why not try using the initToHost method and see if this fixes you=20
>>> problem.
>>> Easiest way to check is change your
>>> dbQuery=3D[[MCPConnection alloc] init];
>>> to
>>> dbQuery=3D [MCPConnection alloc];
>>>
>>> in the DataController init method
>>>
>>> then use the initToHost method in your establishConnectionToServer:=20=
>>> method in place of the call to connectWithLogin.
>>>
>>> hope this helps, also out of interest which method were you in when=20=
>>> you got the error exception in your debugger (which of your=20
>>> methods?) this may help tell Serge which method was bombing out
>>>
>>> let me know how you get on.
>>>
>>> JOhn
>>>
>>>
>>> On Thursday, September 25, 2003, at 11:46 AM, Ezat Hashim wrote:
>>>
>>>> Gee Thanks! I have attached my small app.
>>>> <SMySQLTester.2.tar.gz>
>>>> On Thursday, September 25, 2003, at 05:42 AM, John Guy wrote:
>>>>
>>>
- ----------------------------------------------------
Serge Cohen
GPG Key ID: 9CBB58FB
- ----------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (Darwin)
iD8DBQE/dII95EPeG5y7WPsRAsnFAKDWQPAmWNwHdgBFj4XJgA7HDtAhPACeJm/B
9mASE5/sCjBMxRRsrQpxJfg=3D
=3DNF8Z
-----END PGP SIGNATURE-----
|