Thread: [Mysql-cocoa-commits] CVS: SMySQL TO_DO,NONE,1.1.2.1 README,1.1.1.1,1.1.1.1.2.1 SMySQL.h,1.2,1.2.2.1
Brought to you by:
sergecohen
Update of /cvsroot/mysql-cocoa/SMySQL In directory usw-pr-cvs1:/tmp/cvs-serv2036 Modified Files: Tag: version-2 README SMySQL.h MCPConnection.h MCPConnection.m MCPResult.h MCPResult.m Added Files: Tag: version-2 TO_DO Log Message: Modified classes to be: MCPConnection MCPResult Added a TO_DO, updated the README file (fom within the project). Serge Cohen; MySQL Cocoa project, 2002-06-01. --- NEW FILE: TO_DO --- TO DO list for this version of SMySQL (version 2): ++Handling NULL fields: - Create a MCPNull object to reflect NULL columns values in retrieved table rows. - Create a "MCPNull" category for NSObject with only one method : isMCPNull (Being able to check if any object returned by SMySQL is a MCPNull) ++MCPResult: Centralising the field type recognition and filling of proper objects: - A single method doing the work : fetchRowAsType:(unsigned int) aType; - Wrapper for getting rows as Dictionnary or Array. Making a category for additional (optional) methods: - Getting a single column: - (NSArray *) fetchColWithIndex:(unsigned int) aCol; - (NSArray *) fetchColWithName:(NSString *) aColName; (Wrapping the previous one) - Adding bidimensional array data retrieval (in a Category?) ++MCPConnection Making a category to add some useful (but not mandatory) features: - (id) getFirstFieldFromQuery:(NSString *) query; (Frist column of first row of the result) - (id) getFirstRowFromQuery:(NSString *) query asType:(unsigned int) aType; (obvious) - (NSArray *) getAllRowsFromQuery:(NSString *) queryasType:(unsigned int) aType; (using 2D possibility of MCPResult) - (NSArray *) getQuery:(NSString *) query colWithIndex:(unsigned int) aCol; (Getting a single column form the query) - (NSArray *) getQuery:(NSString *) query colWithName:(NSString *) aColName; Index: README =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/README,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -C2 -d -r1.1.1.1 -r1.1.1.1.2.1 *** README 1 Jan 2002 17:16:29 -0000 1.1.1.1 --- README 1 Jun 2002 20:58:18 -0000 1.1.1.1.2.1 *************** *** 1,18 **** READ ME file for SMySQL, from MySQL Cocoa project. - To install this framework, you need a properly compiled libmysqlclient.dylib. - To find instruction on how to compile mysql on Mac OSX 10.1.x, go to the Documentation package from the site. - You need also to have the headers coming with libmysqlclient: ! mysql.h ! mysql_com.h ! mysql_version.h ! These headers should be in : /usr/local/include/mysql/ ! The library should be in : /usr/local/lib/mysql/ ! Otherwise you will have to change some settings in the target, so that the compiler and linker can find the proper files. ! Serge Cohen, 30 December 2001. --- 1,82 ---- READ ME file for SMySQL, from MySQL Cocoa project. ! ++++++++++++++++++++++++++++++++ ! + Aim of this Framework: ! ++++++++++++++++++++++++++++++++ ! This framework is aimed at programers which want to connect to a MySQL database from a application developed with Cocoa (and maybe GNUStep, although I've not tried myself). The framework is based on the C API of MySQL and hence uses (or include) the libmysqlclient library coming from MySQL. ! Objects from this framework (namely MCPConnection and MCPResult) belongs to the Model layer and uses anly the Foundation API. The development is done with Project Builder (the IDE from Apple -previously NeXT-), and no other environment is supported (yet !! if you want ot port it to another env. I'll be glad to provide you with all the information I know which can help you). ! ! ++++++++++++++++++++++++++++++++ ! + Flavours: ! ++++++++++++++++++++++++++++++++ ! ! The SMySQL framework comes in 3 flavours, that's because: ! 1. Frameworks can have different policies to be installed on a system and used by an App. ! 2. The framework relies on the code from the libmysqlclient library to work. ! ! Let's first adress these two points, and then the description of the flavoured should much clearer. ! ! 1. Frameworks location (Indeed I would suggest you read Apple doc about OS X...): ! If a framework is used by many applications, it's better to have a central repository for him. This repository exist, it's the folder Library/Frameworks (of any of the domains: System, Network, User ...). Any application which need one of these framework just declare the of the framework, and the dynamic linker will look for it in all these repository (in a given order which you'll find in Apple doc). ! -> Lets call this kind of framework a 'Global framework' ! ! In the mean time, an application programmer might want to wrap some of his application capabilities in a framework (to be able to use it in another app easily). In this case it's better if the framework does not take place (and namespace) in the central repository, even more it's better if you don't have to ask the user to install a framework to be able to run the app. In this aim you can embed the framework in the application bundle (in the "Contents/Frameworks/" folder of the bundle). Then you should set precisely the path to reach the framework (at compile time). ! -> Lets call this kind of framework a 'embeded framework' ! ! ! 2. The form libmysqlclient used: ! The same kind question arise about libmysqlclient, it exists in two forms: static library (archive), or dynamic lib (shared object). ! The dynamic lib is much better to use if the user had it setted personnaly (give coherence to all the applications using the client side of mysql) BUT it might forces the user to install one more thing. ! ! In the case the application might be installed by users who doe not to bother with mysql installation, it's much easier for the user to have the library staticly linked (one once for all by the developer) in the framework. ! ! ! -- Now the 3 flavours of the framework: ! 1. Target : SMySQL ! The framework is to be installed in one of the central repository. And because you're not afraid of this knid of installs, this one relies on the dynamic version of libmysqlclient. One of the big PLUS of this install is that you can use the framework even in "Foundation" type application (command line interface, launched in terminal). ! ! 2. Target : SMySQL_embeded ! Kind of a mix target (exists mainly for historic reasons). The framework is made to be embeded in the application (and not clutter the central repositories), but it relies on the dynamic verison of the library (interesting if you have to install this lib for other API, like PERL's). ! ! 3. Target : SMySQL_fully_embeded ! The framework is made to be embeded in the application bundle and DOES NOT rely on any external libraries (except the one provided as standard with Mac OS X). In this target the libmysqlclient is staticly linked in the framework. ! ! NB: Only 1. can be used from a "Foundation" application (like SMySQL_test). For GUI application the method recommended is 3. (from Apple recommandation). ! ! ! ++++++++++++++++++++++++++++++++ ! + Installation: ! ++++++++++++++++++++++++++++++++ ! ! If you want to install flavours 1 or 2 (targets SMySQL or SMySQL_embeded), you have to have a working version of libmysqlclient together with the corresponding header files. You can get some infos on how to install the libmysqlclient lib in the Documentation package from the web site (mysql-cocoa.sf.net). ! ! For flavour 1: ! in Terminal (after installation of libmysqlclient), cd to the source directory and issue the two commands: ! >cd SMySQL.pbproj ! >pbxbuild -target SMySQL -buildstyle Development install DSTROOT=/ ! ! For flavour 2: ! Once the client side of MySQL is installed, you just have to open the project in Project Builder, select the target (SMySQL_embeded), the buildstyle and click the Build button. ! ! For flavour 3: ! Just get the project in PB, select target (SMySQL_fully_embeded), build style, and press Build. ! ! In all the three case the html doc is generated if you have AutoDoc (http://www.misckit.com/press/press_autodoc_2.0b7.html) installed. It will be in the directory: ! SMySQL.framework/Resources/English.lproj/Documentation/ ! ! ! ++++++++++++++++++++++++++++++++ ! + Use: ! ++++++++++++++++++++++++++++++++ ! ! ! Still to come.... ! ! ! Serge Cohen; MySQL Cocoa project, 2002-01-06. Index: SMySQL.h =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/SMySQL.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** SMySQL.h 7 May 2002 18:43:58 -0000 1.2 --- SMySQL.h 1 Jun 2002 20:58:18 -0000 1.2.2.1 *************** *** 25,30 **** #import <Foundation/Foundation.h> ! #import <SMySQL/SMySQLResult.h> ! #import <SMySQL/SMySQLConnection.h> #import "mysql.h" //#import <SMySQL/mysql.h> --- 25,30 ---- #import <Foundation/Foundation.h> ! #import <SMySQL/MCPResult.h> ! #import <SMySQL/MCPConnection.h> #import "mysql.h" //#import <SMySQL/mysql.h> Index: MCPConnection.h =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/Attic/MCPConnection.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** MCPConnection.h 30 May 2002 13:52:01 -0000 1.1.2.1 --- MCPConnection.h 1 Jun 2002 20:58:18 -0000 1.1.2.2 *************** *** 1,4 **** // ! // SMySQLConnection.h // SMySQL // --- 1,4 ---- // ! // MCPConnection.h // SMySQL // *************** *** 29,39 **** //#import <SMySQL/SMySQL.h> ! @class SMySQLResult; ! #define kSMySQL_default_option CLIENT_COMPRESS ! #define kSMySQLConnectionDefaultSocket MYSQL_UNIX_ADDR ! #define kSMySQLConnection_error_not_inited 1000 ! @interface SMySQLConnection : NSObject { MYSQL *mConnection; /*"The inited MySQL connection"*/ BOOL mConnected; /*"Reflect the fact that the connection is already in place or not"*/ --- 29,44 ---- //#import <SMySQL/SMySQL.h> ! @class MCPResult; ! // Deafult connection option ! extern const unsigned int kMCPConnectionDefaultOption; ! // Default socket (from the mysql.h used at compile time) ! extern NSString *kMCPConnectionDefaultSocket; ! ! // Added to mysql error code ! extern const unsigned int kMCPConnectionNotInited; ! ! @interface MCPConnection : NSObject { MYSQL *mConnection; /*"The inited MySQL connection"*/ BOOL mConnected; /*"Reflect the fact that the connection is already in place or not"*/ *************** *** 77,81 **** - (NSString *) prepareString:(NSString *) theString; ! - (SMySQLResult *) queryString:(NSString *) query; - (my_ulonglong) affectedRows; --- 82,86 ---- - (NSString *) prepareString:(NSString *) theString; ! - (MCPResult *) queryString:(NSString *) query; - (my_ulonglong) affectedRows; *************** *** 86,97 **** Getting description of the database structure "*/ ! - (SMySQLResult *) listDBs; ! - (SMySQLResult *) listDBsLike:(NSString *) dbsName; ! - (SMySQLResult *) listTables; ! - (SMySQLResult *) listTablesLike:(NSString *) tablesName; // Next method uses SHOW TABLES FROM db to be sure that the db is not changed during this call. ! - (SMySQLResult *) listTablesFromDB:(NSString *) dbName like:(NSString *) tablesName; ! - (SMySQLResult *) listFieldsFromTable:(NSString *) tableName; ! - (SMySQLResult *) listFieldsFromTable:(NSString *) tableName like:(NSString *) fieldsName; --- 91,102 ---- Getting description of the database structure "*/ ! - (MCPResult *) listDBs; ! - (MCPResult *) listDBsLike:(NSString *) dbsName; ! - (MCPResult *) listTables; ! - (MCPResult *) listTablesLike:(NSString *) tablesName; // Next method uses SHOW TABLES FROM db to be sure that the db is not changed during this call. ! - (MCPResult *) listTablesFromDB:(NSString *) dbName like:(NSString *) tablesName; ! - (MCPResult *) listFieldsFromTable:(NSString *) tableName; ! - (MCPResult *) listFieldsFromTable:(NSString *) tableName like:(NSString *) fieldsName; *************** *** 104,108 **** - (NSString *) serverInfo; - (NSNumber *) protoInfo; ! - (SMySQLResult *) listProcesses; - (BOOL) killProcess:(unsigned long) pid; --- 109,113 ---- - (NSString *) serverInfo; - (NSNumber *) protoInfo; ! - (MCPResult *) listProcesses; - (BOOL) killProcess:(unsigned long) pid; Index: MCPConnection.m =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/Attic/MCPConnection.m,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** MCPConnection.m 30 May 2002 13:41:47 -0000 1.1.2.1 --- MCPConnection.m 1 Jun 2002 20:58:18 -0000 1.1.2.2 *************** *** 1,4 **** // ! // SMySQLConnection.m // SMySQL // --- 1,4 ---- // ! // MCPConnection.m // SMySQL // *************** *** 24,42 **** ! #import "SMySQLConnection.h" ! #import "SMySQLResult.h" ! @implementation SMySQLConnection /*" This class is used to keep a connection with a MySQL server, it correspond to the MYSQL structure of the C API, or the database handle of the PERL DBI/DBD interface. ! You have to start any work on a MySQL server by getting a working SMySQLConnection object. Most likely you will use this kind of code: !{ ! SMySQLConnection *theConnec = [SMySQLConnection alloc]; ! SMySQLResult *theRes; theConnec = [theConnec initToHost::albert.com withLogin:@"toto" password:@"albert" port:0]; --- 24,46 ---- ! #import "MCPConnection.h" ! #import "MCPResult.h" + const unsigned int kMCPConnectionDefaultOption = CLIENT_COMPRESS; + NSString *kMCPConnectionDefaultSocket = MYSQL_UNIX_ADDR; + const unsigned int kMCPConnection_Not_Inited = 1000; ! ! @implementation MCPConnection /*" This class is used to keep a connection with a MySQL server, it correspond to the MYSQL structure of the C API, or the database handle of the PERL DBI/DBD interface. ! You have to start any work on a MySQL server by getting a working MCPConnection object. Most likely you will use this kind of code: !{ ! MCPConnection *theConnec = [MCPConnection alloc]; ! MCPResult *theRes; theConnec = [theConnec initToHost::albert.com withLogin:@"toto" password:@"albert" port:0]; *************** *** 100,104 **** "*/ { ! return [SMySQLConnection encodingForMySQLEncoding:MYSQL_CHARSET]; } --- 104,108 ---- "*/ { ! return [MCPConnection encodingForMySQLEncoding:MYSQL_CHARSET]; } *************** *** 117,121 **** } // mEncoding = NSISOLatin1StringEncoding; ! mEncoding = [SMySQLConnection encodingForMySQLEncoding:mysql_character_set_name(mConnection)]; return self; } --- 121,125 ---- } // mEncoding = NSISOLatin1StringEncoding; ! mEncoding = [MCPConnection encodingForMySQLEncoding:mysql_character_set_name(mConnection)]; return self; } *************** *** 193,200 **** #{NOT YET IMPLEMENTED} ! This method is to be used for getting special option for a connection, in which case the SMySQLConnection has to be inited with the init method, then option are selected, finally connection is done using one of the connect methods: !{ ! SMySQLConnection *theConnect = [[SMySQLConnection alloc] init]; [theConnect setConnectionOption: option withArgument: arg]; [theConnect connectToHost:albert.com withLogin:@"toto" password:@"albert" port:0]; --- 197,204 ---- #{NOT YET IMPLEMENTED} ! This method is to be used for getting special option for a connection, in which case the MCPConnection has to be inited with the init method, then option are selected, finally connection is done using one of the connect methods: !{ ! MCPConnection *theConnect = [[MCPConnection alloc] init]; [theConnect setConnectionOption: option withArgument: arg]; [theConnect connectToHost:albert.com withLogin:@"toto" password:@"albert" port:0]; *************** *** 246,257 **** } if (theSocket == NULL) { ! theSocket = kSMySQLConnectionDefaultSocket; } ! theRet = mysql_real_connect(mConnection, theHost, theLogin, thePass, NULL, port, theSocket, kSMySQL_default_option); if (theRet != mConnection) { return mConnected = NO; } ! mEncoding = [SMySQLConnection encodingForMySQLEncoding:mysql_character_set_name(mConnection)]; return mConnected = YES; } --- 250,261 ---- } if (theSocket == NULL) { ! theSocket = kMCPConnectionDefaultSocket; } ! theRet = mysql_real_connect(mConnection, theHost, theLogin, thePass, NULL, port, theSocket, kMCPConnectionDefaultOption); if (theRet != mConnection) { return mConnected = NO; } ! mEncoding = [MCPConnection encodingForMySQLEncoding:mysql_character_set_name(mConnection)]; return mConnected = YES; } *************** *** 261,265 **** /*" Selects a database to work with. ! The SMySQLConnection object needs to be properly inited and connected to a server. If a connection is not yet set or the selection of the database didn't work, returns NO. Returns YES in normal cases where the database is properly selected. --- 265,269 ---- /*" Selects a database to work with. ! The MCPConnection object needs to be properly inited and connected to a server. If a connection is not yet set or the selection of the database didn't work, returns NO. Returns YES in normal cases where the database is properly selected. *************** *** 303,312 **** return mysql_errno(mConnection); } ! return kSMySQLConnection_error_not_inited; } - (BOOL) isConnected /*" ! Returns YES if the SMySQLConnection is connected to a DB, NO otherwise. "*/ { --- 307,316 ---- return mysql_errno(mConnection); } ! return kMCPConnection_Not_Inited; } - (BOOL) isConnected /*" ! Returns YES if the MCPConnection is connected to a DB, NO otherwise. "*/ { *************** *** 359,370 **** ! - (SMySQLResult *) queryString:(NSString *) query /*" ! Takes a query string and return an SMySQLResult object holding the result of the query. ! The returned SMySQLResult is not retained, the client is responsible for that (it's autoreleased before being returned) Note that if you want to use this method with binary data (in the query), you should use !{prepareBinaryData:} to include the binary data in the query string. "*/ { ! SMySQLResult *theResult = [SMySQLResult alloc]; const char *theCQuery = [self cStringFromString:query]; int theQueryCode; --- 363,374 ---- ! - (MCPResult *) queryString:(NSString *) query /*" ! Takes a query string and return an MCPResult object holding the result of the query. ! The returned MCPResult is not retained, the client is responsible for that (it's autoreleased before being returned) Note that if you want to use this method with binary data (in the query), you should use !{prepareBinaryData:} to include the binary data in the query string. "*/ { ! MCPResult *theResult = [MCPResult alloc]; const char *theCQuery = [self cStringFromString:query]; int theQueryCode; *************** *** 413,417 **** ! - (SMySQLResult *) listDBs /*" Just a fast wrapper for the more complex !{listDBsWithPattern:} method. --- 417,421 ---- ! - (MCPResult *) listDBs /*" Just a fast wrapper for the more complex !{listDBsWithPattern:} method. *************** *** 422,426 **** ! - (SMySQLResult *) listDBsLike:(NSString *) dbsName /*" Returns a list of database which name correspond to the SQL regular expression in 'pattern'. --- 426,430 ---- ! - (MCPResult *) listDBsLike:(NSString *) dbsName /*" Returns a list of database which name correspond to the SQL regular expression in 'pattern'. *************** *** 430,434 **** "*/ { ! SMySQLResult *theResult = [SMySQLResult alloc]; MYSQL_RES *theResPtr; --- 434,438 ---- "*/ { ! MCPResult *theResult = [MCPResult alloc]; MYSQL_RES *theResPtr; *************** *** 457,461 **** ! - (SMySQLResult *) listTables /*" Make sure a DB is selected (with !{selectDB} method) first. --- 461,465 ---- ! - (MCPResult *) listTables /*" Make sure a DB is selected (with !{selectDB} method) first. *************** *** 466,470 **** ! - (SMySQLResult *) listTablesLike:(NSString *) tablesName /*" From within a database, give back the list of table which name correspond to tablesName (with wild card %, _ extension). Correspond to queryString:@"SHOW tables [LIKE wild]"; uses mysql_list_tables function. --- 470,474 ---- ! - (MCPResult *) listTablesLike:(NSString *) tablesName /*" From within a database, give back the list of table which name correspond to tablesName (with wild card %, _ extension). Correspond to queryString:@"SHOW tables [LIKE wild]"; uses mysql_list_tables function. *************** *** 473,477 **** "*/ { ! SMySQLResult *theResult = [SMySQLResult alloc]; MYSQL_RES *theResPtr; --- 477,481 ---- "*/ { ! MCPResult *theResult = [MCPResult alloc]; MYSQL_RES *theResPtr; *************** *** 500,504 **** ! - (SMySQLResult *) listTablesFromDB:(NSString *) dbName like:(NSString *) tablesName /*" List tables in DB specified by dbName and corresponding to pattern. --- 504,508 ---- ! - (MCPResult *) listTablesFromDB:(NSString *) dbName like:(NSString *) tablesName /*" List tables in DB specified by dbName and corresponding to pattern. *************** *** 507,511 **** "*/ { ! SMySQLResult *theResult; if ((tablesName == nil) || ([tablesName isEqualToString:@""])) { --- 511,515 ---- "*/ { ! MCPResult *theResult; if ((tablesName == nil) || ([tablesName isEqualToString:@""])) { *************** *** 521,525 **** ! - (SMySQLResult *)listFieldsFromTable:(NSString *)tableName /*" Just a fast wrapper for the more complex list !{listFieldsWithPattern:forTable:} method. --- 525,529 ---- ! - (MCPResult *)listFieldsFromTable:(NSString *)tableName /*" Just a fast wrapper for the more complex list !{listFieldsWithPattern:forTable:} method. *************** *** 530,534 **** ! - (SMySQLResult *) listFieldsFromTable:(NSString *) tableName like:(NSString *) fieldsName /*" Show all the fields of the table tableName which name correspond to pattern (with wild card expansion : %,_). --- 534,538 ---- ! - (MCPResult *) listFieldsFromTable:(NSString *) tableName like:(NSString *) fieldsName /*" Show all the fields of the table tableName which name correspond to pattern (with wild card expansion : %,_). *************** *** 537,541 **** "*/ { ! SMySQLResult *theResult; if ((fieldsName == nil) || ([fieldsName isEqualToString:@""])) { --- 541,545 ---- "*/ { ! MCPResult *theResult; if ((fieldsName == nil) || ([fieldsName isEqualToString:@""])) { *************** *** 590,599 **** ! - (SMySQLResult *) listProcesses /*" Lists active process "*/ { ! SMySQLResult *theResult = [SMySQLResult alloc]; MYSQL_RES *theResPtr; --- 594,603 ---- ! - (MCPResult *) listProcesses /*" Lists active process "*/ { ! MCPResult *theResult = [MCPResult alloc]; MYSQL_RES *theResPtr; *************** *** 647,651 **** - (void) disconnect /*" ! Disconnects a connected SMySQLConnection object; used by #{-dealloc} method. "*/ { --- 651,655 ---- - (void) disconnect /*" ! Disconnects a connected MCPConnection object; used by #{-dealloc} method. "*/ { *************** *** 660,664 **** - (void)dealloc /*" ! The standard deallocation method for SMySQLConnection objects. "*/ { --- 664,668 ---- - (void)dealloc /*" ! The standard deallocation method for MCPConnection objects. "*/ { *************** *** 673,677 **** Sets the encoding used by the server for data transfert. Used to make sure the output of the query result is ok even for non-ascii characters ! The character set (encoding) used by the db is passed to the SMySQLConnection object upon connection, so most likely the encoding (from -encoding) method is already the proper one. That is to say : It's unlikely you will need to call this method directly, and #{if ever you use it, do it at your own risks}. --- 677,681 ---- Sets the encoding used by the server for data transfert. Used to make sure the output of the query result is ok even for non-ascii characters ! The character set (encoding) used by the db is passed to the MCPConnection object upon connection, so most likely the encoding (from -encoding) method is already the proper one. That is to say : It's unlikely you will need to call this method directly, and #{if ever you use it, do it at your own risks}. *************** *** 693,697 **** - (const char *) cStringFromString:(NSString *) theString /*" ! For internal use only. Transforms a NSString to a C type string (ending with \0) using the character set from the SMySQLConnection. Lossy conversions are enabled. "*/ --- 697,701 ---- - (const char *) cStringFromString:(NSString *) theString /*" ! For internal use only. Transforms a NSString to a C type string (ending with \0) using the character set from the MCPConnection. Lossy conversions are enabled. "*/ *************** *** 711,715 **** - (NSString *) stringWithCString:(const char *) theCString /*" ! Returns a NSString from a C style string encoded with the character set of theSMySQLConnection. "*/ { --- 715,719 ---- - (NSString *) stringWithCString:(const char *) theCString /*" ! Returns a NSString from a C style string encoded with the character set of theMCPConnection. "*/ { Index: MCPResult.h =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/Attic/MCPResult.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** MCPResult.h 30 May 2002 13:52:01 -0000 1.1.2.1 --- MCPResult.h 1 Jun 2002 20:58:18 -0000 1.1.2.2 *************** *** 1,4 **** // ! // SMySQLResult.h // SMySQL // --- 1,4 ---- // ! // MCPResult.h // SMySQL // *************** *** 29,35 **** //#import <SMySQL/SMySQL.h> ! //@class SMySQLRow; ! ! @interface SMySQLResult : NSObject { MYSQL_RES *mResult; /*"The MYSQL_RES structure of the C API"*/ NSArray *mNames; /*"An NSArray holding the name of the columns"*/ --- 29,33 ---- //#import <SMySQL/SMySQL.h> ! @interface MCPResult : NSObject { MYSQL_RES *mResult; /*"The MYSQL_RES structure of the C API"*/ NSArray *mNames; /*"An NSArray holding the name of the columns"*/ *************** *** 39,43 **** /*" ! Init used #{only} by #{SMySQLConnection} "*/ --- 37,41 ---- /*" ! Init used #{only} by #{MCPConnection} "*/ Index: MCPResult.m =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/Attic/MCPResult.m,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** MCPResult.m 30 May 2002 13:52:01 -0000 1.1.2.1 --- MCPResult.m 1 Jun 2002 20:58:18 -0000 1.1.2.2 *************** *** 1,4 **** // ! // SMySQLResult.m // SMySQL // --- 1,4 ---- // ! // MCPResult.m // SMySQL // *************** *** 24,33 **** ! #import "SMySQLConnection.h" ! #import "SMySQLResult.h" ! @implementation SMySQLResult /*" Hold the results of a query to a MySQL database server. It correspond to the MYSQL_RES structure of the C API, and to the statement handle of the PERL DBI/DBD. --- 24,33 ---- ! #import "MCPConnection.h" ! #import "MCPResult.h" ! @implementation MCPResult /*" Hold the results of a query to a MySQL database server. It correspond to the MYSQL_RES structure of the C API, and to the statement handle of the PERL DBI/DBD. *************** *** 35,43 **** Uses the #{mysql_store_result()} function from the C API. ! This object is generated only by a SMySQLConnection object, in this way (see #{SMySQLConnection} documentation): !{ ! SMySQLConnection *theConnec = [SMySQLConnection alloc]; ! SMySQLResult *theRes; NSDictionnary *theDict; NSArray *theColNames; --- 35,43 ---- Uses the #{mysql_store_result()} function from the C API. ! This object is generated only by a MCPConnection object, in this way (see #{MCPConnection} documentation): !{ ! MCPConnection *theConnec = [MCPConnection alloc]; ! MCPResult *theRes; NSDictionnary *theDict; NSArray *theColNames; *************** *** 62,66 **** - (id)initWithMySQLPtr:(MYSQL *)mySQLPtr encoding:(NSStringEncoding)theEncoding /*" ! initialise a SMySQLResult, it is used internally by SMySQLConnection #{queryString:} method: the only proper way to get a running SMySQLResult object. "*/ { --- 62,66 ---- - (id)initWithMySQLPtr:(MYSQL *)mySQLPtr encoding:(NSStringEncoding)theEncoding /*" ! initialise a MCPResult, it is used internally by MCPConnection #{queryString:} method: the only proper way to get a running MCPResult object. "*/ { *************** *** 83,87 **** */ if (mMySQLLocales == NULL) { ! mMySQLLocales = [[SMySQLConnection getMySQLLocales] retain]; } return self; --- 83,87 ---- */ if (mMySQLLocales == NULL) { ! mMySQLLocales = [[MCPConnection getMySQLLocales] retain]; } return self; *************** *** 91,97 **** - (id)initWithResPtr:(MYSQL_RES *)mySQLResPtr encoding:(NSStringEncoding)theEncoding /*" ! This metod it is used internally by SMySQLConnection object when it have already a MYSQL_RES object to initialise SMySQLResult object. ! Initialise a SMySQLResult with the MYSQL_RES pointer (returned by such a function as mysql_list_dbs). ! NB: SMySQLResult should be made by using one of the method of SMySQLConnection. "*/ { --- 91,97 ---- - (id)initWithResPtr:(MYSQL_RES *)mySQLResPtr encoding:(NSStringEncoding)theEncoding /*" ! This metod it is used internally by MCPConnection object when it have already a MYSQL_RES object to initialise MCPResult object. ! Initialise a MCPResult with the MYSQL_RES pointer (returned by such a function as mysql_list_dbs). ! NB: MCPResult should be made by using one of the method of MCPConnection. "*/ { *************** *** 114,118 **** */ if (mMySQLLocales == NULL) { ! mMySQLLocales = [[SMySQLConnection getMySQLLocales] retain]; } return self; --- 114,118 ---- */ if (mMySQLLocales == NULL) { ! mMySQLLocales = [[MCPConnection getMySQLLocales] retain]; } return self; *************** *** 121,129 **** - (id)init /*" ! Empty init, normaly of NO use to the user, again, SMySQLResult should be made through calls to SMySQLConnection "*/ { self = [super init]; ! mEncoding = [SMySQLConnection defaultMySQLEncoding]; if (mResult) { mysql_free_result(mResult); --- 121,129 ---- - (id)init /*" ! Empty init, normaly of NO use to the user, again, MCPResult should be made through calls to MCPConnection "*/ { self = [super init]; ! mEncoding = [MCPConnection defaultMySQLEncoding]; if (mResult) { mysql_free_result(mResult); *************** *** 135,139 **** } if (mMySQLLocales == NULL) { ! mMySQLLocales = [[SMySQLConnection getMySQLLocales] retain]; } return self; --- 135,139 ---- } if (mMySQLLocales == NULL) { ! mMySQLLocales = [[MCPConnection getMySQLLocales] retain]; } return self; *************** *** 532,536 **** default: theType = @"unknown"; ! NSLog (@"in fetchTypesAsArray : Unknown type for column %d of the SMySQLResult, type = %d", (int)i, (int)theField[i].type); break; } --- 532,536 ---- default: theType = @"unknown"; ! NSLog (@"in fetchTypesAsArray : Unknown type for column %d of the MCPResult, type = %d", (int)i, (int)theField[i].type); break; } *************** *** 638,642 **** default: theType = @"unknown"; ! NSLog (@"in fetchTypesAsDictionary : Unknown type for column %d of the SMySQLResult, type = %d", (int)i, (int)theField[i].type); break; } --- 638,642 ---- default: theType = @"unknown"; ! NSLog (@"in fetchTypesAsDictionary : Unknown type for column %d of the MCPResult, type = %d", (int)i, (int)theField[i].type); break; } *************** *** 730,738 **** - (NSString *)description /*" ! Return a (long) string containing the table of results, first line being the fields name, next line(s) the row(s). Useful to have NSLog logging a SMySQLResult (example). "*/ { if (mResult == NULL) { ! return @"This is an empty SMySQLResult\n"; } else { --- 730,738 ---- - (NSString *)description /*" ! Return a (long) string containing the table of results, first line being the fields name, next line(s) the row(s). Useful to have NSLog logging a MCPResult (example). "*/ { if (mResult == NULL) { ! return @"This is an empty MCPResult\n"; } else { *************** *** 742,747 **** MYSQL_ROW_OFFSET thePosition; ! // First line, saying we are displaying a SMySQLResult ! [theString appendString:@"SMySQLResult:\n"]; // Second line: the field names, tab separated [self fetchFieldsName]; --- 742,747 ---- MYSQL_ROW_OFFSET thePosition; ! // First line, saying we are displaying a MCPResult ! [theString appendString:@"MCPResult:\n"]; // Second line: the field names, tab separated [self fetchFieldsName]; *************** *** 787,791 **** - (const char *)cStringFromString:(NSString *)theString /*" ! For internal use only. Transform a NSString to a C type string (ended with \0) using ethe character set from the SMySQLConnection. Lossy conversions are enabled. "*/ --- 787,791 ---- - (const char *)cStringFromString:(NSString *)theString /*" ! For internal use only. Transform a NSString to a C type string (ended with \0) using ethe character set from the MCPConnection. Lossy conversions are enabled. "*/ *************** *** 805,809 **** - (NSString *)stringWithCString:(const char *)theCString /*" ! Return a NSString from a C style string encoded with the character set of theSMySQLConnection. "*/ { --- 805,809 ---- - (NSString *)stringWithCString:(const char *)theCString /*" ! Return a NSString from a C style string encoded with the character set of theMCPConnection. "*/ { |