Thread: [Mysql-cocoa-commits] CVS: SMySQL SMySQLConstants.h,NONE,1.1.2.1 MCPNull.h,NONE,1.1.2.1 MCPNull.m,NO
Brought to you by:
sergecohen
From: Serge C. <ser...@us...> - 2002-06-03 13:11:54
|
Update of /cvsroot/mysql-cocoa/SMySQL In directory usw-pr-cvs1:/tmp/cvs-serv12487 Modified Files: Tag: version-2 TO_DO SMySQL.h MCPConnection.h MCPConnection.m MCPResult.h MCPResult.m Added Files: Tag: version-2 SMySQLConstants.h MCPNull.h MCPNull.m MCPResultPlus.h MCPResultPlus.m Log Message: -Added support for NULL fields in the results. -Easier to maintain methods for retrieving row and types information -Added a MCPResultPlus category, for extra methods to handle and get result rows and column (per column, and 2D) Serge Cohen; MySQL Cocoa project, 2002-06-03. --- NEW FILE: SMySQLConstants.h --- // // SMySQLConstants.h // SMySQL // // Created by Serge Cohen (ser...@m4...) on Mon Jun 03 2002. // Copyright (c) 2001 MySQL Cocoa project. // // This code is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or any later version. // // This code is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // For a copy of the GNU General Public License, visit <http://www.gnu.org/> or // write to the Free Software Foundation, Inc., 59 Temple Place--Suite 330, // Boston, MA 02111-1307, USA. // // More info at <http://mysql-cocoa.sourceforge.net/> // // $Id: typedef enum { MCPTypeArray = 1, MCPTypeDictionary = 2, MCPTypeFlippedArray = 3, MCPTypeFlippedDictionary = 4 } MCPReturnType; --- NEW FILE: MCPNull.h --- // // MCPNull.h // SMySQL // // Created by Serge Cohen (ser...@m4...) on Sun Jun 02 2002. // Copyright (c) 2001 MySQL Cocoa project. // // This code is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or any later version. // // This code is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // For a copy of the GNU General Public License, visit <http://www.gnu.org/> or // write to the Free Software Foundation, Inc., 59 Temple Place--Suite 330, // Boston, MA 02111-1307, USA. // // More info at <http://mysql-cocoa.sourceforge.net/> // // $Id: #import <Foundation/Foundation.h> @interface NSObject (MCPNSNullTest) /*" Addin to NSObject. "*/ - (BOOL) isNSNull; @end --- NEW FILE: MCPNull.m --- // // MCPNull.m // SMySQL // // Created by Serge Cohen (ser...@m4...) on Sun Jun 02 2002. // Copyright (c) 2001 MySQL Cocoa project. // // This code is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or any later version. // // This code is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // For a copy of the GNU General Public License, visit <http://www.gnu.org/> or // write to the Free Software Foundation, Inc., 59 Temple Place--Suite 330, // Boston, MA 02111-1307, USA. // // More info at <http://mysql-cocoa.sourceforge.net/> // // $Id: #import "MCPNull.h" @implementation NSObject (MCPNSNullTest) /*" This Category is meant to make any kind of object the possible target to the test (isNSNull) "*/ - (BOOL) isNSNull { return [self isMemberOfClass:[NSNull class]]; } @end --- NEW FILE: MCPResultPlus.h --- // // MCPResultPlus.h // SMySQL // // Created by Serge Cohen (ser...@m4...) on Mon Jun 03 2002. // Copyright (c) 2001 MySQL Cocoa project. // // This code is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or any later version. // // This code is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // For a copy of the GNU General Public License, visit <http://www.gnu.org/> or // write to the Free Software Foundation, Inc., 59 Temple Place--Suite 330, // Boston, MA 02111-1307, USA. // // More info at <http://mysql-cocoa.sourceforge.net/> // // $Id: #import <Foundation/Foundation.h> #import "MCPResult.h" @interface MCPResult (MCPResultPlus) /*" Getting a complete column as an array "*/ - (NSArray *) fetchColAtIndex:(unsigned int) aCol; - (NSArray *) fetchColWithName:(NSString *) aColName; /*" Getting the complete result as 2D array "*/ - (id) fetch2DResultAsType:(MCPReturnType) aType; @end --- NEW FILE: MCPResultPlus.m --- // // MCPResultPlus.m // SMySQL // // Created by Serge Cohen (ser...@m4...) on Mon Jun 03 2002. // Copyright (c) 2001 MySQL Cocoa project. // // This code is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or any later version. // // This code is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // For a copy of the GNU General Public License, visit <http://www.gnu.org/> or // write to the Free Software Foundation, Inc., 59 Temple Place--Suite 330, // Boston, MA 02111-1307, USA. // // More info at <http://mysql-cocoa.sourceforge.net/> // // $Id: #import "MCPResultPlus.h" @implementation MCPResult (MCPResultPlus) - (NSArray *) fetchColAtIndex:(unsigned int) aCol /*" Getting a complete column into a NSArray (1D). The index starts from 0 (first column). The index 0 of the returned array always correspond to the first row (ie: returned NSArray is indexed by row number), the read position is restored after to it's initial position after the read. "*/ { NSMutableArray *theCol = [NSMutableArray arrayWithCapacity:[self numOfRows]]; MYSQL_ROW_OFFSET thePosition; NSArray *theRow; if ((mResult == NULL) || ([self numOfRows] == 0)) { // If there is no results, returns nil. return nil; } if (aCol >= mNumOfFields) { // Bad column number NSLog (@"The index : %d is not within the range 0 - %d\n", (long)aCol, (long)mNumOfFields); return nil; } thePosition = mysql_row_tell(mResult); [self dataSeek:0]; // One might want to have optimized code here. Maybe in later versions while (theRow = [self fetchRowAsType:MCPTypeArray]) { [theCol addObject:[theRow objectAtIndex:aCol]]; } // Returning to the proper row mysql_row_seek(mResult,thePosition); return [NSArray arrayWithArray:theCol]; } - (NSArray *) fetchColWithName:(NSString *) aColName /*" The same as #{fetchColAtIndex:}, but the choice of the column is done by it's field name. Indeed it is just a wrapper to #{fetchColAtIndex}. "*/ { unsigned int theCol; if (mResult == NULL) { // If there is no results, returns nil. return nil; } if (mNames == nil) { [self fetchFieldsName]; } theCol = [mNames indexOfObject:aColName]; if (theCol == NSNotFound) { NSLog(@"No column have been found with name : %@\n",aColName); return nil; } return [self fetchColAtIndex:theCol]; } - (id) fetch2DResultAsType:(MCPReturnType) aType; /*" Returns the complete result table in a 2D object, which type depends on aType: - MCPTypeArray : a NSArray of rows as NSArray, - MCPTypeDictionary : a NSArray of rows as NSDictionary, - MCPTypeFlippedArray : a NSArray of columns (as NSArray), - MCPTypeFlippedDictionary : a NSDictionary of columns (as NSArray) In any case the read position is restored at the end of the call (hence a fetchRow will get the same row wether this method is called before it or not). "*/ { id theTable, theVect; MYSQL_ROW_OFFSET thePosition; unsigned int i; if (mResult == NULL) { // If there is no results, returns nil. return nil; } thePosition = mysql_row_tell(mResult); [self dataSeek:0]; switch (aType) { case MCPTypeArray : theTable = [NSMutableArray arrayWithCapacity:[self numOfRows]]; while (theVect = [self fetchRowAsArray]) { [theTable addObject:theVect]; } theTable = [NSArray arrayWithArray:theTable]; break; case MCPTypeDictionary : theTable = [NSMutableArray arrayWithCapacity:[self numOfRows]]; while (theVect = [self fetchRowAsDictionary]) { [theTable addObject:theVect]; } theTable = [NSArray arrayWithArray:theTable]; break; case MCPTypeFlippedArray : theTable = [NSMutableArray arrayWithCapacity:mNumOfFields]; for (i=0; i<mNumOfFields; i++) { [theTable addObject:[self fetchColAtIndex:i]]; } theTable = [NSArray arrayWithArray:theTable]; break; case MCPTypeFlippedDictionary : theTable = [NSMutableDictionary dictionaryWithCapacity:mNumOfFields]; if (mNames == nil) { [self fetchFieldsName]; } for (i=0; i<mNumOfFields; i++) { [theTable setObject:[self fetchColAtIndex:i] forKey:[mNames objectAtIndex:i]]; } theTable = [NSDictionary dictionaryWithDictionary:theTable]; break; default : NSLog (@"Unknown MCPReturnType : %d; return nil\n", (int)aType); theTable = nil; break; } mysql_row_seek(mResult,thePosition); return theTable; } @end Index: TO_DO =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/Attic/TO_DO,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** TO_DO 1 Jun 2002 20:58:18 -0000 1.1.2.1 --- TO_DO 3 Jun 2002 13:11:45 -0000 1.1.2.2 *************** *** 4,24 **** - 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; --- 4,29 ---- - 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) + -> Ok. + ++MCPResult: Centralising the field type recognition and filling of proper objects: ! - A single method doing the work : fetchRowAsType:(MCPReturnType) aType; - Wrapper for getting rows as Dictionnary or Array. + - Again with fetchTypesAsType: (MCPReturnType) aType; + wrappers + -> Ok. Making a category for additional (optional) methods: - Getting a single column: ! - (NSArray *) fetchColAtIndex:(unsigned int) aCol; - (NSArray *) fetchColWithName:(NSString *) aColName; (Wrapping the previous one) - Adding bidimensional array data retrieval (in a Category?) + -> Ok ++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:(MCPReturnType) aType; (obvious) ! - (NSArray *) getAllRowsFromQuery:(NSString *) query asType:(MCPReturnType) 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: SMySQL.h =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/SMySQL.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** SMySQL.h 1 Jun 2002 20:58:18 -0000 1.2.2.1 --- SMySQL.h 3 Jun 2002 13:11:45 -0000 1.2.2.2 *************** *** 25,30 **** --- 25,33 ---- #import <Foundation/Foundation.h> + #import <SMySQL/SMySQLConstants.h> + #import <SMySQL/MCPNull.h> #import <SMySQL/MCPResult.h> #import <SMySQL/MCPConnection.h> + #import <SMySQL/MCPResultsPlus.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.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** MCPConnection.h 1 Jun 2002 20:58:18 -0000 1.1.2.2 --- MCPConnection.h 3 Jun 2002 13:11:45 -0000 1.1.2.3 *************** *** 26,31 **** #import <Foundation/Foundation.h> #import "mysql.h" ! //#import <SMySQL/mysql.h> ! //#import <SMySQL/SMySQL.h> @class MCPResult; --- 26,31 ---- #import <Foundation/Foundation.h> #import "mysql.h" ! #import "SMySQLConstants.h" ! @class MCPResult; *************** *** 35,39 **** // Default socket (from the mysql.h used at compile time) ! extern NSString *kMCPConnectionDefaultSocket; // Added to mysql error code --- 35,39 ---- // Default socket (from the mysql.h used at compile time) ! extern const char *kMCPConnectionDefaultSocket; // Added to mysql error code *************** *** 51,54 **** --- 51,59 ---- + (NSStringEncoding) encodingForMySQLEncoding:(const char *) mysqlEncoding; + (NSStringEncoding) defaultMySQLEncoding; + + /*" + Class maintenance + "*/ + + (void) initialize; /*" Index: MCPConnection.m =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/Attic/MCPConnection.m,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** MCPConnection.m 1 Jun 2002 20:58:18 -0000 1.1.2.2 --- MCPConnection.m 3 Jun 2002 13:11:45 -0000 1.1.2.3 *************** *** 28,32 **** const unsigned int kMCPConnectionDefaultOption = CLIENT_COMPRESS; ! NSString *kMCPConnectionDefaultSocket = MYSQL_UNIX_ADDR; const unsigned int kMCPConnection_Not_Inited = 1000; --- 28,32 ---- const unsigned int kMCPConnectionDefaultOption = CLIENT_COMPRESS; ! const char *kMCPConnectionDefaultSocket = MYSQL_UNIX_ADDR; const unsigned int kMCPConnection_Not_Inited = 1000; *************** *** 105,108 **** --- 105,120 ---- { return [MCPConnection encodingForMySQLEncoding:MYSQL_CHARSET]; + } + + + + (void) initialize + /*" + Initialize the class version to 2.0.0 + "*/ + { + if (self = [MCPConnection class]) { + [self setVersion:020000]; // Ma.Mi.Re -> MaMiRe + } + return; } Index: MCPResult.h =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/Attic/MCPResult.h,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** MCPResult.h 1 Jun 2002 20:58:18 -0000 1.1.2.2 --- MCPResult.h 3 Jun 2002 13:11:46 -0000 1.1.2.3 *************** *** 26,31 **** #import <Foundation/Foundation.h> #import "mysql.h" ! //#import <SMySQL/mysql.h> ! //#import <SMySQL/SMySQL.h> @interface MCPResult : NSObject { --- 26,31 ---- #import <Foundation/Foundation.h> #import "mysql.h" ! #import "SMySQLConstants.h" ! @interface MCPResult : NSObject { *************** *** 34,38 **** --- 34,44 ---- NSDictionary *mMySQLLocales; /*"A Locales dictionary to define the locales of MySQL"*/ NSStringEncoding mEncoding; /*"The encoding used by MySQL server, to ISO-1 default"*/ + unsigned int mNumOfFields; /*"The number of fields in the result"*/ } + /*" + Class maintenance + "*/ + + + (void) initialize; /*" *************** *** 40,46 **** "*/ ! - (id)initWithMySQLPtr:(MYSQL *)mySQLPtr encoding:(NSStringEncoding)theEncoding; ! - (id)initWithResPtr:(MYSQL_RES *)mySQLResPtr encoding:(NSStringEncoding)theEncoding; ! - (id)init; /*" --- 46,52 ---- "*/ ! - (id) initWithMySQLPtr:(MYSQL *) mySQLPtr encoding:(NSStringEncoding) theEncoding; ! - (id) initWithResPtr:(MYSQL_RES *) mySQLResPtr encoding:(NSStringEncoding) theEncoding; ! - (id) init; /*" *************** *** 48,53 **** "*/ ! - (my_ulonglong)numOfRows; ! - (unsigned int)numOfFields; /*" --- 54,59 ---- "*/ ! - (my_ulonglong) numOfRows; ! - (unsigned int) numOfFields; /*" *************** *** 55,62 **** "*/ ! - (void)dataSeek:(my_ulonglong)row; ! - (NSDictionary *)fetchRowAsDictionary; ! - (NSArray *)fetchRowAsArray; /*" --- 61,69 ---- "*/ ! - (void) dataSeek:(my_ulonglong) row; ! - (id) fetchRowAsType:(MCPReturnType) aType; ! - (NSArray *) fetchRowAsArray; ! - (NSDictionary *) fetchRowAsDictionary; /*" *************** *** 64,79 **** "*/ ! - (NSArray *)fetchFieldsName; ! - (NSArray *)fetchTypesAsArray; ! - (NSDictionary *)fetchTypesAsDictionary; ! - (BOOL)isBlobAtIndex:(unsigned int)index; ! - (BOOL)isBlobForKey:(NSString *)key; /*" Utility method "*/ ! - (NSString *)description; /*" --- 71,87 ---- "*/ ! - (NSArray *) fetchFieldsName; ! - (id) fetchTypesAsType:(MCPReturnType) aType; ! - (NSArray *) fetchTypesAsArray; ! - (NSDictionary *) fetchTypesAsDictionary; ! - (BOOL) isBlobAtIndex:(unsigned int) index; ! - (BOOL) isBlobForKey:(NSString *) key; /*" Utility method "*/ ! - (NSString *) description; /*" *************** *** 81,91 **** "*/ ! - (void)dealloc; /*" Private methods, internam use only "*/ ! - (const char *)cStringFromString:(NSString *)theString; ! - (NSString *)stringWithCString:(const char *)theCString; @end --- 89,99 ---- "*/ ! - (void) dealloc; /*" Private methods, internam use only "*/ ! - (const char *) cStringFromString:(NSString *) theString; ! - (NSString *) stringWithCString:(const char *) theCString; @end Index: MCPResult.m =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/Attic/MCPResult.m,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** MCPResult.m 1 Jun 2002 20:58:18 -0000 1.1.2.2 --- MCPResult.m 3 Jun 2002 13:11:46 -0000 1.1.2.3 *************** *** 25,28 **** --- 25,29 ---- #import "MCPConnection.h" + #import "MCPNull.h" #import "MCPResult.h" *************** *** 60,64 **** "*/ ! - (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. --- 61,77 ---- "*/ ! + (void) initialize ! /*" ! Initialize the class version to 2.0.0 ! "*/ ! { ! if (self = [MCPResult class]) { ! [self setVersion:020000]; // Ma.Mi.Re -> MaMiRe ! } ! return; ! } ! ! ! - (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. *************** *** 76,79 **** --- 89,98 ---- } mResult = mysql_store_result(mySQLPtr); + if (mResult) { + mNumOfFields = mysql_num_fields(mResult); + } + else { + mNumOfFields = 0; + } /* if (mResult == NULL) { *************** *** 89,93 **** ! - (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. --- 108,112 ---- ! - (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. *************** *** 107,110 **** --- 126,135 ---- } mResult = mySQLResPtr; + if (mResult) { + mNumOfFields = mysql_num_fields(mResult); + } + else { + mNumOfFields = 0; + } /* if (mResult == NULL) { *************** *** 119,123 **** } ! - (id)init /*" Empty init, normaly of NO use to the user, again, MCPResult should be made through calls to MCPConnection --- 144,148 ---- } ! - (id) init /*" Empty init, normaly of NO use to the user, again, MCPResult should be made through calls to MCPConnection *************** *** 137,145 **** mMySQLLocales = [[MCPConnection getMySQLLocales] retain]; } return self; } ! - (my_ulonglong)numOfRows /*" Return the number of rows selected by the query. --- 162,171 ---- mMySQLLocales = [[MCPConnection getMySQLLocales] retain]; } + mNumOfFields = 0; return self; } ! - (my_ulonglong) numOfRows /*" Return the number of rows selected by the query. *************** *** 153,169 **** ! - (unsigned int)numOfFields /*" ! Return the number of fields selected by the query. "*/ { if (mResult) { ! return mysql_num_fields(mResult); } ! return 0; } ! - (void)dataSeek:(my_ulonglong)row /*" Go to a precise row in the selected result. 0 is the very first row --- 179,195 ---- ! - (unsigned int) numOfFields /*" ! Return the number of fields selected by the query. As a side effect it forces an update of the number of fields. "*/ { if (mResult) { ! return mNumOfFields = mysql_num_fields(mResult); } ! return mNumOfFields = 0; } ! - (void) dataSeek:(my_ulonglong) row /*" Go to a precise row in the selected result. 0 is the very first row *************** *** 177,183 **** ! - (NSDictionary *)fetchRowAsDictionary /*" ! Return the next row of the result as a dictionary, the key being the field name, the object a proper object for handling the information in the field (NSString, NSNumber ...). "*/ { --- 203,211 ---- ! - (id) fetchRowAsType:(MCPReturnType) aType /*" ! Return the next row of the result as a collection of type defined by aType (namely MCPTypeArray or MCPTypeDictionary). Each field of the row is made into a proper object to hold the info (NSNumber, NSString...). ! ! This method returned directly the !{mutable} object generated while going through all the columns "*/ { *************** *** 186,200 **** MYSQL_FIELD *theField; int i; ! unsigned int theNumFields; ! NSMutableDictionary *theDict; ! if (mResult == NULL) { // If there is no results, returns nil, as after the last row... return nil; } - - if (mNames == NULL) { - [self fetchFieldsName]; - } theRow = mysql_fetch_row(mResult); --- 214,223 ---- MYSQL_FIELD *theField; int i; ! id theReturn; ! if (mResult == NULL) { // If there is no results, returns nil, as after the last row... return nil; } theRow = mysql_fetch_row(mResult); *************** *** 202,408 **** return nil; } - - // NSMutableDictionary *theDict = [NSMutableDictionary dictionaryWithCapacity:theNumFields]; ! theNumFields = [self numOfFields]; ! theDict = [NSMutableDictionary dictionaryWithCapacity:theNumFields]; ! theLengths = mysql_fetch_lengths(mResult); theField = mysql_fetch_fields(mResult); ! for (i=0; i<theNumFields; i++) { ! id theCurrentObj,theDataObj; ! char *theData = calloc(sizeof(char),theLengths[i]+1); ! memcpy(theData, theRow[i],theLengths[i]); ! theData[theLengths[i]] = '\0'; ! // NSLog (@"in fetchRowAsDictionary : field type is %d, for column %d", (int)theField[i].type, (int)i); ! switch (theField[i].type) { ! case FIELD_TYPE_TINY: ! case FIELD_TYPE_SHORT: ! case FIELD_TYPE_LONG: ! case FIELD_TYPE_INT24: ! case FIELD_TYPE_LONGLONG: ! theCurrentObj = [NSNumber numberWithLong:atol(theData)]; ! break; ! case FIELD_TYPE_DECIMAL: ! case FIELD_TYPE_FLOAT: ! case FIELD_TYPE_DOUBLE: ! theCurrentObj = [NSNumber numberWithDouble:atof(theData)]; ! break; ! case FIELD_TYPE_TIMESTAMP: // Indeed one should check which format it is (14,12...2) and get the corresponding format string // a switch on theLength[i] would do that... // Here it will crash if it's not default presentation : TIMESTAMP(14) ! theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithUTF8String:theData] calendarFormat:@"%Y%m%d%H%M%S"]; ! break; ! case FIELD_TYPE_DATE: ! theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithUTF8String:theData] calendarFormat:@"%Y-%m-%d"]; ! break; ! case FIELD_TYPE_TIME: // Pass them back as string for the moment... not TIME object in Cocoa (so far) ! theCurrentObj = [NSString stringWithUTF8String:theData]; ! case FIELD_TYPE_DATETIME: ! theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithUTF8String:theData] calendarFormat:@"%Y-%m-%d %H:%M:%S"]; ! break; ! case FIELD_TYPE_YEAR: ! theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithUTF8String:theData] calendarFormat:@"%Y"]; ! break; ! case FIELD_TYPE_VAR_STRING: ! case FIELD_TYPE_STRING: ! theDataObj = [NSData dataWithBytes:theData length:theLengths[i]]; ! theCurrentObj = [[NSString alloc] initWithData:theDataObj encoding:mEncoding]; ! [theCurrentObj autorelease]; ! break; ! case FIELD_TYPE_TINY_BLOB: ! case FIELD_TYPE_BLOB: ! case FIELD_TYPE_MEDIUM_BLOB: ! case FIELD_TYPE_LONG_BLOB: ! theCurrentObj = [NSData dataWithBytes:theData length:theLengths[i]]; ! break; ! case FIELD_TYPE_SET: ! theDataObj = [NSData dataWithBytes:theData length:theLengths[i]]; ! theCurrentObj = [[NSString alloc] initWithData:theDataObj encoding:mEncoding]; ! [theCurrentObj autorelease]; ! break; ! case FIELD_TYPE_ENUM: ! theDataObj = [NSData dataWithBytes:theData length:theLengths[i]]; ! theCurrentObj = [[NSString alloc] initWithData:theDataObj encoding:mEncoding]; ! [theCurrentObj autorelease]; ! break; ! case FIELD_TYPE_NULL: ! theCurrentObj = nil; ! break; ! case FIELD_TYPE_NEWDATE: // Don't know what the format for this type is... ! theDataObj = [NSData dataWithBytes:theData length:theLengths[i]]; ! theCurrentObj = [[NSString alloc] initWithData:theDataObj encoding:mEncoding]; ! [theCurrentObj autorelease]; break; ! default: ! NSLog (@"in fetchRowAsDictionary : Unknown type : %d for column %d, send back a NSData object", (int)theField[i].type, (int)i); ! theCurrentObj = [NSData dataWithBytes:theData length:theLengths[i]]; break; } - [theDict setObject:theCurrentObj forKey:[mNames objectAtIndex:i]]; - free(theData); } ! ! return [NSDictionary dictionaryWithDictionary:theDict]; } ! - (NSArray *)fetchRowAsArray /*" Return the next row of the result as an array, the index in select field order, the object a proper object for handling the information in the field (NSString, NSNumber ...). "*/ { ! MYSQL_ROW theRow; ! unsigned long *theLengths; ! MYSQL_FIELD *theField; ! int i; ! unsigned int theNumFields; ! NSMutableArray* theArray; ! ! if (mResult == NULL) { ! // If there is no results, returns nil, as after the last row... ! return nil; } ! ! theRow = mysql_fetch_row(mResult); ! if (theRow == NULL) { return nil; } - // A row have been retrieved succesfully, put in in the dictionary - - theNumFields = [self numOfFields]; - theArray = [NSMutableArray arrayWithCapacity:theNumFields]; ! theLengths = mysql_fetch_lengths(mResult); ! theField = mysql_fetch_fields(mResult); ! for (i=0; i<theNumFields; i++) { ! id theCurrentObj,theDataObj; ! char *theData = calloc(sizeof(char),theLengths[i]+1); ! memcpy(theData, theRow[i],theLengths[i]); ! theData[theLengths[i]] = '\0'; ! // NSLog (@"in fetchRowAsArray : field type is %d, for column %d", (int)theField[i].type, (int)i); ! switch (theField[i].type) { ! case FIELD_TYPE_TINY: ! case FIELD_TYPE_SHORT: ! case FIELD_TYPE_LONG: ! case FIELD_TYPE_INT24: ! case FIELD_TYPE_LONGLONG: ! theCurrentObj = [NSNumber numberWithLong:atol(theData)]; ! break; ! case FIELD_TYPE_DECIMAL: ! case FIELD_TYPE_FLOAT: ! case FIELD_TYPE_DOUBLE: ! theCurrentObj = [NSNumber numberWithDouble:atof(theData)]; ! break; ! case FIELD_TYPE_TIMESTAMP: ! // Indeed one should check which format it is (14,12...2) and get the corresponding format string ! // a switch on theLength[i] would do that... ! // Here it will crash if it's not default presentation : TIMESTAMP(14) ! theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithUTF8String:theData] calendarFormat:@"%Y%m%d%H%M%S"]; ! break; ! case FIELD_TYPE_DATE: ! theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithUTF8String:theData] calendarFormat:@"%Y-%m-%d"]; ! break; ! case FIELD_TYPE_TIME: ! // Pass them back as string for the moment... not TIME object in Cocoa (so far) ! theCurrentObj = [NSString stringWithUTF8String:theData]; ! case FIELD_TYPE_DATETIME: ! theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithUTF8String:theData] calendarFormat:@"%Y-%m-%d %H:%M:%S"]; ! break; ! case FIELD_TYPE_YEAR: ! theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithUTF8String:theData] calendarFormat:@"%Y"]; ! break; ! case FIELD_TYPE_VAR_STRING: ! case FIELD_TYPE_STRING: ! theDataObj = [NSData dataWithBytes:theData length:theLengths[i]]; ! theCurrentObj = [[NSString alloc] initWithData:theDataObj encoding:mEncoding]; ! [theCurrentObj autorelease]; ! break; ! case FIELD_TYPE_TINY_BLOB: ! case FIELD_TYPE_BLOB: ! case FIELD_TYPE_MEDIUM_BLOB: ! case FIELD_TYPE_LONG_BLOB: ! theCurrentObj = [NSData dataWithBytes:theData length:theLengths[i]]; ! break; ! case FIELD_TYPE_SET: ! theDataObj = [NSData dataWithBytes:theData length:theLengths[i]]; ! theCurrentObj = [[NSString alloc] initWithData:theDataObj encoding:mEncoding]; ! [theCurrentObj autorelease]; ! break; ! case FIELD_TYPE_ENUM: ! theDataObj = [NSData dataWithBytes:theData length:theLengths[i]]; ! theCurrentObj = [[NSString alloc] initWithData:theDataObj encoding:mEncoding]; ! [theCurrentObj autorelease]; ! break; ! case FIELD_TYPE_NULL: ! theCurrentObj = nil; ! break; ! case FIELD_TYPE_NEWDATE: ! // Don't know what the format for this type is... ! theDataObj = [NSData dataWithBytes:theData length:theLengths[i]]; ! theCurrentObj = [[NSString alloc] initWithData:theDataObj encoding:mEncoding]; ! [theCurrentObj autorelease]; ! break; ! default: ! NSLog (@"in fetchRowAsArray : Unknown type : %d for column %d, send back a NSData object", (int)theField[i].type, (int)i); ! theCurrentObj = [NSData dataWithBytes:theData length:theLengths[i]]; ! break; ! } ! [theArray addObject:theCurrentObj]; ! free(theData); } - - return [NSArray arrayWithArray:theArray]; } ! - (NSArray *)fetchFieldsName /*" Generate the mNames if not already generated, and return it. --- 225,377 ---- return nil; } ! switch (aType) { ! case MCPTypeArray: ! theReturn = [NSMutableArray arrayWithCapacity:mNumOfFields]; ! break; ! case MCPTypeDictionary: ! if (mNames == nil) { ! [self fetchFieldsName]; ! } ! theReturn = [NSMutableDictionary dictionaryWithCapacity:mNumOfFields]; ! break; ! default : ! NSLog (@"Unknown type : %d, will return an Array!\n", aType); ! theReturn = [NSMutableArray arrayWithCapacity:mNumOfFields]; ! break; ! } ! theLengths = mysql_fetch_lengths(mResult); theField = mysql_fetch_fields(mResult); ! for (i=0; i<mNumOfFields; i++) { ! id theCurrentObj; ! if (theRow[i] == NULL) { ! theCurrentObj = [NSNull null]; ! } ! else { ! char *theData = calloc(sizeof(char),theLengths[i]+1); ! memcpy(theData, theRow[i],theLengths[i]); ! theData[theLengths[i]] = '\0'; ! switch (theField[i].type) { ! case FIELD_TYPE_TINY: ! case FIELD_TYPE_SHORT: ! case FIELD_TYPE_LONG: ! case FIELD_TYPE_INT24: ! case FIELD_TYPE_LONGLONG: ! theCurrentObj = [NSNumber numberWithLong:atol(theData)]; ! break; ! case FIELD_TYPE_DECIMAL: ! case FIELD_TYPE_FLOAT: ! case FIELD_TYPE_DOUBLE: ! theCurrentObj = [NSNumber numberWithDouble:atof(theData)]; ! break; ! case FIELD_TYPE_TIMESTAMP: // Indeed one should check which format it is (14,12...2) and get the corresponding format string // a switch on theLength[i] would do that... // Here it will crash if it's not default presentation : TIMESTAMP(14) ! theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithUTF8String:theData] calendarFormat:@"%Y%m%d%H%M%S"]; ! break; ! case FIELD_TYPE_DATE: ! theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithUTF8String:theData] calendarFormat:@"%Y-%m-%d"]; ! break; ! case FIELD_TYPE_TIME: // Pass them back as string for the moment... not TIME object in Cocoa (so far) ! theCurrentObj = [NSString stringWithUTF8String:theData]; ! case FIELD_TYPE_DATETIME: ! theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithUTF8String:theData] calendarFormat:@"%Y-%m-%d %H:%M:%S"]; ! break; ! case FIELD_TYPE_YEAR: ! theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithUTF8String:theData] calendarFormat:@"%Y"]; ! break; ! case FIELD_TYPE_VAR_STRING: ! case FIELD_TYPE_STRING: ! theCurrentObj = [self stringWithCString:theData]; ! break; ! case FIELD_TYPE_TINY_BLOB: ! case FIELD_TYPE_BLOB: ! case FIELD_TYPE_MEDIUM_BLOB: ! case FIELD_TYPE_LONG_BLOB: ! theCurrentObj = [NSData dataWithBytes:theData length:theLengths[i]]; ! break; ! case FIELD_TYPE_SET: ! theCurrentObj = [self stringWithCString:theData]; ! break; ! case FIELD_TYPE_ENUM: ! theCurrentObj = [self stringWithCString:theData]; ! break; ! case FIELD_TYPE_NULL: ! theCurrentObj = nil; ! break; ! case FIELD_TYPE_NEWDATE: // Don't know what the format for this type is... ! theCurrentObj = [self stringWithCString:theData]; ! break; ! default: ! NSLog (@"in fetchRowAsDictionary : Unknown type : %d for column %d, send back a NSData object", (int)theField[i].type, (int)i); ! theCurrentObj = [NSData dataWithBytes:theData length:theLengths[i]]; ! break; ! } ! free(theData); ! } ! switch (aType) { ! case MCPTypeArray : ! [theReturn addObject:theCurrentObj]; break; ! case MCPTypeDictionary : ! [theReturn setObject:theCurrentObj forKey:[mNames objectAtIndex:i]]; ! break; ! default : ! [theReturn addObject:theCurrentObj]; break; } } ! ! return theReturn; } ! ! - (NSArray *) fetchRowAsArray /*" Return the next row of the result as an array, the index in select field order, the object a proper object for handling the information in the field (NSString, NSNumber ...). + + Just a !{typed} wrapper for method #{fetchRosAsType:} (with arg MCPTypeArray). + + + NB: Returned object is immutable. "*/ { ! NSMutableArray *theArray = [self fetchRowAsType:MCPTypeArray]; ! if (theArray) { ! return [NSArray arrayWithArray:theArray]; } ! else { return nil; } + } ! - (NSDictionary *) fetchRowAsDictionary ! /*" ! Return the next row of the result as a dictionary, the key being the field name, the object a proper object for handling the information in the field (NSString, NSNumber ...). ! Just a !{typed} wrapper for method #{fetchRosAsType:} (with arg MCPTypeDictionary). ! NB: Returned object is immutable. ! "*/ ! { ! NSMutableDictionary *theDict = [self fetchRowAsType:MCPTypeDictionary]; ! if (theDict) { ! return [NSDictionary dictionaryWithDictionary:theDict]; ! } ! else { ! return nil; } } ! ! - (NSArray *) fetchFieldsName /*" Generate the mNames if not already generated, and return it. *************** *** 440,462 **** } ! - (NSArray *)fetchTypesAsArray /*" ! Return an array of the fields' types. "*/ { - unsigned int theNumFields; int i; ! NSMutableArray *theTypesArray; MYSQL_FIELD *theField; if (mResult == NULL) { // If no results, give an empty array. Maybe it's better to give a nil pointer? ! return ([NSArray array]); } ! ! theNumFields = [self numOfFields]; ! theTypesArray = [NSMutableArray arrayWithCapacity: theNumFields]; ! theField = mysql_fetch_fields(mResult); ! for (i=0; i<theNumFields; i++) { NSString *theType; switch (theField[i].type) { --- 409,446 ---- } ! ! - (id) fetchTypesAsType:(MCPReturnType) aType /*" ! Return a collection of the fields's type. The type of collection is choosen by the aType variable (MCPTypeArray or MCPTypeDictionary). ! ! This method returned directly the !{mutable} object generated while going through all the columns "*/ { int i; ! id theTypes; MYSQL_FIELD *theField; if (mResult == NULL) { // If no results, give an empty array. Maybe it's better to give a nil pointer? ! return nil; } ! ! switch (aType) { ! case MCPTypeArray: ! theTypes = [NSMutableArray arrayWithCapacity:mNumOfFields]; ! break; ! case MCPTypeDictionary: ! if (mNames == nil) { ! [self fetchFieldsName]; ! } ! theTypes = [NSMutableDictionary dictionaryWithCapacity:mNumOfFields]; ! break; ! default : ! NSLog (@"Unknown type : %d, will return an Array!\n", aType); ! theTypes = [NSMutableArray arrayWithCapacity:mNumOfFields]; ! break; ! } ! theField = mysql_fetch_fields(mResult); ! for (i=0; i<mNumOfFields; i++) { NSString *theType; switch (theField[i].type) { *************** *** 535,651 **** break; } ! [theTypesArray addObject:theType]; } ! ! return ([NSArray arrayWithArray:theTypesArray]); } ! - (NSDictionary*)fetchTypesAsDictionary /*" ! Return a dictionnary of the fields' types (keys are the fields' names). "*/ { ! unsigned int theNumFields; ! int i; ! NSMutableDictionary *theTypesDict; ! MYSQL_FIELD *theField; ! ! if (mResult == NULL) { ! // If no results, give an empty array. Maybe it's better to give a nil pointer? ! return ([NSDictionary dictionary]); } ! ! if (mNames == NULL) { ! [self fetchFieldsName]; } ! theNumFields = [self numOfFields]; ! theTypesDict = [NSMutableDictionary dictionaryWithCapacity: theNumFields]; ! theField = mysql_fetch_fields(mResult); ! for (i=0; i<theNumFields; i++) { ! NSString *theType; ! switch (theField[i].type) { ! case FIELD_TYPE_TINY: ! theType = @"tiny"; ! break; ! case FIELD_TYPE_SHORT: ! theType = @"short"; ! break; ! case FIELD_TYPE_LONG: ! theType = @"long"; ! break; ! case FIELD_TYPE_INT24: ! theType = @"int24"; ! break; ! case FIELD_TYPE_LONGLONG: ! theType = @"longlong"; ! break; ! case FIELD_TYPE_DECIMAL: ! theType = @"decimal"; ! break; ! case FIELD_TYPE_FLOAT: ! theType = @"float"; ! break; ! case FIELD_TYPE_DOUBLE: ! theType = @"double"; ! break; ! case FIELD_TYPE_TIMESTAMP: ! theType = @"timestamp"; ! break; ! case FIELD_TYPE_DATE: ! theType = @"date"; ! break; ! case FIELD_TYPE_TIME: ! theType = @"time"; ! break; ! case FIELD_TYPE_DATETIME: ! theType = @"datetime"; ! break; ! case FIELD_TYPE_YEAR: ! theType = @"year"; ! break; ! case FIELD_TYPE_VAR_STRING: ! theType = @"varstring"; ! break; ! case FIELD_TYPE_STRING: ! theType = @"string"; ! break; ! case FIELD_TYPE_TINY_BLOB: ! theType = @"tinyblob"; ! break; ! case FIELD_TYPE_BLOB: ! theType = @"blob"; ! break; ! case FIELD_TYPE_MEDIUM_BLOB: ! theType = @"mediumblob"; ! break; ! case FIELD_TYPE_LONG_BLOB: ! theType = @"longblob"; ! break; ! case FIELD_TYPE_SET: ! theType = @"set"; ! break; ! case FIELD_TYPE_ENUM: ! theType = @"enum"; ! break; ! case FIELD_TYPE_NULL: ! theType = @"null"; ! break; ! case FIELD_TYPE_NEWDATE: ! theType = @"newdate"; ! break; ! default: ! theType = @"unknown"; ! NSLog (@"in fetchTypesAsDictionary : Unknown type for column %d of the MCPResult, type = %d", (int)i, (int)theField[i].type); ! break; ! } ! [theTypesDict setObject:theType forKey:[mNames objectAtIndex:i]]; } - - return ([NSDictionary dictionaryWithDictionary:theTypesDict]); } ! - (BOOL)isBlobAtIndex:(unsigned int)index /*" Return YES if the field with the given index is a BLOB. It should be used to discriminates between BLOBs and TEXTs. --- 519,574 ---- break; } ! switch (aType) { ! case MCPTypeArray : ! [theTypes addObject:theType]; ! break; ! case MCPTypeDictionary : ! [theTypes setObject:theType forKey:[mNames objectAtIndex:i]]; ! break; ! default : ! [theTypes addObject:theType]; ! break; ! } } ! ! return theTypes; } ! ! - (NSArray *) fetchTypesAsArray /*" ! Return an array of the fields' types. ! ! NB: Returned object is immutable. "*/ { ! NSMutableArray *theArray = [self fetchTypesAsType:MCPTypeArray]; ! if (theArray) { ! return [NSArray arrayWithArray:theArray]; } ! else { ! return nil; } + } ! - (NSDictionary*) fetchTypesAsDictionary ! /*" ! Return a dictionnary of the fields' types (keys are the fields' names). ! ! NB: Returned object is immutable. ! "*/ ! { ! NSMutableDictionary *theDict = [self fetchTypesAsType:MCPTypeDictionary]; ! if (theDict) { ! return [NSDictionary dictionaryWithDictionary:theDict]; ! } ! else { ! return nil; } } ! ! - (BOOL) isBlobAtIndex:(unsigned int) index /*" Return YES if the field with the given index is a BLOB. It should be used to discriminates between BLOBs and TEXTs. *************** *** 685,689 **** } ! - (BOOL)isBlobForKey:(NSString *)key /*" Return YES if the field (by name) with the given index is a BLOB. It should be used to discriminates between BLOBs and TEXTs. --- 608,612 ---- } ! - (BOOL) isBlobForKey:(NSString *) key /*" Return YES if the field (by name) with the given index is a BLOB. It should be used to discriminates between BLOBs and TEXTs. *************** *** 728,732 **** ! - (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). --- 651,655 ---- ! - (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). *************** *** 738,750 **** else { NSMutableString *theString = [NSMutableString stringWithCapacity:0]; ! int i, numFields; NSArray *theRow; 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]; ! for (i=0; i<((numFields = [mNames count])-1); i++) { [theString appendFormat:@"%@\t", [mNames objectAtIndex:i]]; } --- 661,673 ---- else { NSMutableString *theString = [NSMutableString stringWithCapacity:0]; ! int i; NSArray *theRow; MYSQL_ROW_OFFSET thePosition; // First line, saying we are displaying a MCPResult ! [theString appendFormat:@"MCPResult: (encoding : %d, dim %d x %d)\n", (long)mEncoding, (long)mNumOfFields, (long)[self numOfRows]]; // Second line: the field names, tab separated [self fetchFieldsName]; ! for (i=0; i<(mNumOfFields-1); i++) { [theString appendFormat:@"%@\t", [mNames objectAtIndex:i]]; } *************** *** 754,758 **** [self dataSeek:0]; while (theRow = [self fetchRowAsArray]) { ! for (i=0; i<(numFields - 1); i++) { [theString appendFormat:@"%@\t", [theRow objectAtIndex:i]]; } --- 677,681 ---- [self dataSeek:0]; while (theRow = [self fetchRowAsArray]) { ! for (i=0; i<(mNumOfFields - 1); i++) { [theString appendFormat:@"%@\t", [theRow objectAtIndex:i]]; } *************** *** 766,770 **** ! - (void)dealloc /* Do one really needs an explanation for this method? Which by the way you should not use... --- 689,693 ---- ! - (void) dealloc /* Do one really needs an explanation for this method? Which by the way you should not use... *************** *** 785,789 **** } ! - (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. --- 708,712 ---- } ! - (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. *************** *** 803,807 **** ! - (NSString *)stringWithCString:(const char *)theCString /*" Return a NSString from a C style string encoded with the character set of theMCPConnection. --- 726,730 ---- ! - (NSString *) stringWithCString:(const char *) theCString /*" Return a NSString from a C style string encoded with the character set of theMCPConnection. |