[Mysql-cocoa-users] Re: SMySQL framework
Brought to you by:
sergecohen
From: Lorenz T. <lo...@te...> - 2003-03-08 15:24:45
|
Dear Serge, Thank you very much for taking the time to respond so detailed. > Sorry not to have answered earlier. I'll try to give you as much info=20= > as I can: As you see I had much longer to answer (I was in holidays and hadn't=20 the possibility to check my emails ;-) > For the SSL issue: > I'm afraid I can not answer the question for sure. What I can tell you=20= > is that on Jaguar (10.2.3 indeed) I managed to compile MySQL with SSL=20= > support (including the libmysqlclient library onn which I rely to make=20= > connection to MySQL servers). This means that even if it is not=20 > already possible to use the framework as is for connecting to MySQL=20 > using SSL, it should not be too difficult to get to this point. > For the answer of how to manage to do it, I can suggest to ways: > 1. Look the documentation of MySQL (client library) and check what is=20= > required to have a SSL connection. Maybe you need to set a particular=20= > flag from the MYSQL pointer. Than you can do it by default (changing=20= > default in the source of the framework). I found in the documentation that I can set the flag CLIENT_SSL in the=20= mysql_real_connect() function. By now I have no possibility to test it=20= because I have not set up my system to work with SSL. If I will find=20 the time, I'll try to set up a test server and test it with your=20 framework. > 2. You can also add a method to MCPConnection to be able to set this=20= > option at runtime. I would make it like this, because the standard way to connect would=20 remain without SSL. > 3. If you can still wait a month (or maybe a bit more), you can wait=20= > for me to have the time to make it. I need this time because I have a=20= > lot of work now and I also need to set a SSL aware MySQL server to=20 > test the new sources... which will take a bit of time for me because=20= > I've never done anything similar alreasdy (basically the time to read=20= > doc, reset properly the setting of my testing server, and then ONLY I=20= > can modify the MCPConnection...). > > By the way, if you chose sol. 2. I'm (obviously) interested by the=20 > modification you make to MCPConnection for further inclusion in the=20 > framework (more likely as the basis of new addition to the framework). I would be glad to help you with this modifications, but unfortunately=20= I also haven't a lot of time to work on these things (and it would take=20= me a lot of time to set up SSL because I never worked with it, and I am=20= rather a Unix newbie too...). > > For the table type: > I don't have precise answer here neither... BUT I have InnoDB running=20= > on my mac, and event if so far I've never used through the framework,=20= > it should not be to hard for me to test it. SO I'll try to give you a=20= > documented answer in the coming two weeks (still I don't foresee any=20= > reasons for that 'incompatibility', ie. my guess would be that the=20 > problem does not come from the framework). I'm nearly sure that this is a problem of the MySQL server=20 configuration. But I never worked with this tables and therefore I=20 can't be sure of this. If you could try it (maybe with my app), it=20 would be great, but it isn't that important or urgent. > For the last question I'm not sure to get it right. Let me try to=20 > rephrase it (and tell if I'm wrong): > When you retrieve a BLOB (or TEXT) from the DB it comes as a NSData=20 > object. You want this NSData object to be (eventualy) edited as text=20= > by the user. The problem you are facing is that if you transform this=20= > NSData to a NSString and convert it back to a NSData later the two=20 > NSData are different (so if your NSData correspond to a binary format,=20= > the data gets corrupted). It is exactly like this. The string I get from the NSData is for=20 example like this: GIF89a=03=01 plus a lot of strange characters After writing it to the db, there is only the GIF89a=03=01 without the = rest=20 of the string (although I escaped the string using the method=20 prepareString:). I think the method I use to extract the string=20 ([[NSString alloc] initWithData:theValue encoding:[mySQLConnection=20 encoding]]) is wrong. Maybe the problem is that the string contains characters which=20 "terminate" the string, for example if I insert the string in a text=20 file, I don't see anymore the cursor or the end of the file. The same=20 thing happens with the dump files my app writes; there I use the method=20= prepareBinaryData: with the original NSData objects. Reading the dump=20 afterwards works fine, but when I open the file using TextEdit, it=20 displays only the beginning of the file. > > If this is the problem you are facing... I'll have a look to see what=20= > can we do about it. The main problem I'm facing with TEXT and BLOB=20 > column in a table is that one can not discriminate between the two (or=20= > at least I don't know how to do it) without issuing a 'DESCRIBE'=20 > command on the table (they give the same type in the MYSQL_RES field=20= > types). > Indeed after seeing the framework again I think the normal solution=20 > would be not to use prepareBinaryData: but prepareString: instead. ie=20= > once your NSData has been transformed into a string (By the way you=20 > can use the method stringWithText: for that), you don't want to use=20 > prepareBinaryData on it anymore. I'm using the method prepareString:, but it doesn't work. What is the=20 method stringWithText:? I haven't found it in the documentation. Anyway, this isn't very important because it works well with "normal"=20 (non binary) blob fields and some binary blob fields too; and it=20 doesn't make much sense to edit a binary data as a string. Dumping the=20= table or editing a row containing this blob fields works well too. > > Sorry for not answering your question (still I hope you get some=20 > clues), thank you very much for your feed back, and I'd hope we will=20= > continue this thread whenever we have time (meaning: sorry in advance=20= > if I take some time to answer to your next mail). Thank you for helping me and for developing the framework! I would be=20 glad to continue this thread too, but I will also need a bit of time to=20= answer ;-) > Serge. > > PS: As you see, I posted this also to the user mailing list. Please=20 > I'd like that all these mails go there instead of directly to me. I AM=20= > READING the list, and I'm not the only one (from the number of people=20= > inscribed there). I'm sure some of the few persons there might have=20 > already experienced some of your problems and can help you (and me at=20= > the same time). I will make it like this starting with this email! > PPS: I'd be interested to know which version of the framework you are=20= > using, and on what version of your own software you already are. The version I use is still the beta of the version 1.0. I would like to=20= update to v2.0, but I haven't found the time to make the necessary=20 changes to my code (especially I would have to test the app very=20 carefully to be sure that all things work like they worked before).=20 Anyway, all the methods I use in my app work perfectly! The current version of my CocoaMySQL is v0.4 (which I will release=20 after some final testing this evening or tomorrow). You find it on=20 cocoamysql.sourceforge.net if you are interested... > PPPS: last remark: If the problem is the very (very) low traffic on=20 > the mailing list, just consider that the traffic has to start on some=20= > time... That's right. I have subscribed to it today and will try to contribute=20= to the list as much as I can! > > PPPPS: Sorry one more: remind me of linking to your project from the=20= > framework page if it is not already done. This would be great! I have placed a link to the framework page=20 (http://mysql-cocoa.sourceforge.net/) on my site (hope this is the=20 right page). Best Regards, Lorenz > > Le mercredi, 19 f=E9v 2003, =E0 10:13 Europe/Amsterdam, Lorenz Textor = a=20 > =E9crit : > >> Hi Serge, >> >> As I wrote to you some months ago I'm developing an application=20 >> called CocoaMySQL using your framework to connect to the MySQL server=20= >> (see cocoamysql.sourceforge.net). Thanks again for coding this great=20= >> framework and for making it open-source! >> >> I have some questions regarding the framework: >> - Many persons asked me if it is possible to connect securely to the=20= >> MySQL server using SSL. I looked a bit at the MySQL C API and think=20= >> there is an option to do it. Would it be difficult to change the=20 >> framework so that secure connections are possible? Or is it possible=20= >> with the current version yet? >> - Some people wrote me they have problems using other table types=20 >> (InnoDB for example). Can this be a problem of the framework? >> - How can I represent a BLOB field (NSData object) as a string that=20= >> can be edited and saved to the database afterwards? I don't want the=20= >> string to be escaped, so I can use prepareBinaryData: only after=20 >> editing. Now I'm using something like >> [[NSString alloc] initWithData:theData encoding:[mySQLConnection=20= >> encoding]]; >> In most cases this works, but with binary data (for example images)=20= >> the data gets corrupted. >> >> Thank you for your help! >> Best Regards, >> Lorenz >> >> >> > ---------------------------------------------------- > Serge Cohen > > GPG Key ID: Non-Available for the moment. > ---------------------------------------------------- > > --=20 lorenz textor ** sh ** eigerstrasse 21 8200 schaffhausen tf 052 - 624 27 91 ** ticino ** via delle scuole 41 6963 pregassona tf 091 - 940 20 57 ** mobile 076 - 531 71 74 email lo...@te... |