[Mysql-cocoa-commits] CVS: SMySQL/MCPFoundationKit MCPNumber.h,NONE,1.1 MCPNumber.m,NONE,1.1 MCPConn
Brought to you by:
sergecohen
From: Serge C. <ser...@us...> - 2004-08-04 23:24:17
|
Update of /cvsroot/mysql-cocoa/SMySQL/MCPFoundationKit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2859 Modified Files: MCPConnection.h MCPConnection.m MCPFastQueries.m MCPResult.h MCPResult.m SMySQL.h SMySQL_bundled.h SMySQL_static.h Added Files: MCPNumber.h MCPNumber.m Log Message: Added the MCPNumber class to handle the unsigned integer numbers (so that there later printout/comparison/equality are coherent with there signedness). Adde support to the MCPNumber in the MCPResult () --- NEW FILE: MCPNumber.h --- // // MCPNumber.h // NumberTest // // Created by Serge Cohen on Tue Aug 03 2004. // Copyright (c) 2004 __MyCompanyName__. All rights reserved. // #import <Foundation/Foundation.h> @interface MCPNumber : NSNumber { const char *typeCode; NSNumber *number; } - (id) initWithChar:(char) value; - (id) initWithUnsignedChar:(unsigned char) value; - (id) initWithShort:(short) value; - (id) initWithUnsignedShort:(unsigned short) value; - (id) initWithInt:(int) value; - (id) initWithUnsignedInt:(unsigned int) value; - (id) initWithLong:(long) value; - (id) initWithUnsignedLong:(unsigned long) value; - (id) initWithLongLong:(long long) value; - (id) initWithUnsignedLongLong:(unsigned long long) value; - (id) initWithFloat:(float) value; - (id) initWithDouble:(double) value; - (id) initWithBool:(BOOL) value; + (MCPNumber *) numberWithChar:(char) value; + (MCPNumber *) numberWithUnsignedChar:(unsigned char) value; + (MCPNumber *) numberWithShort:(short) value; + (MCPNumber *) numberWithUnsignedShort:(unsigned short) value; + (MCPNumber *) numberWithInt:(int) value; + (MCPNumber *) numberWithUnsignedInt:(unsigned int) value; + (MCPNumber *) numberWithLong:(long) value; + (MCPNumber *) numberWithUnsignedLong:(unsigned long) value; + (MCPNumber *) numberWithLongLong:(long long) value; + (MCPNumber *) numberWithUnsignedLongLong:(unsigned long long) value; + (MCPNumber *) numberWithFloat:(float) value; + (MCPNumber *) numberWithDouble:(double) value; + (MCPNumber *) numberWithBool:(BOOL) value; - (void) dealloc; /*" Most important : NSNumber primitive methods: "*/ - (const char *) objCType; - (void) getValue:(void *) buffer; //- (NSString *) descriptionWithLocale:(NSDictionary *) aLocale; // Not Primitive, but buggy... - (char) charValue; - (unsigned char) unsignedCharValue; - (short) shortValue; - (unsigned short) unsignedShortValue; - (int) intValue; - (unsigned int) unsignedIntValue; - (long) longValue; - (unsigned long) unsignedLongValue; - (long long) longLongValue; - (unsigned long long) unsignedLongLongValue; - (float) floatValue; - (double) doubleValue; - (BOOL) boolValue; @end --- NEW FILE: MCPNumber.m --- // // MCPNumber.m // NumberTest // // Created by Serge Cohen on Tue Aug 03 2004. // Copyright (c) 2004 __MyCompanyName__. All rights reserved. // #import "MCPNumber.h" @implementation MCPNumber #pragma mark Instance Methods: initialilzers. - (id) initWithChar:(char) value { typeCode = @encode(char); number = [[NSNumber alloc] initWithChar:value]; return self; } - (id) initWithUnsignedChar:(unsigned char) value { typeCode = @encode(unsigned char); number = [[NSNumber alloc] initWithUnsignedChar:value]; return self; } - (id) initWithShort:(short) value { typeCode = @encode(short); number = [[NSNumber alloc] initWithShort:value]; return self; } - (id) initWithUnsignedShort:(unsigned short) value { typeCode = @encode(unsigned short); number = [[NSNumber alloc] initWithUnsignedShort:value]; return self; } - (id) initWithInt:(int) value { typeCode = @encode(int); number = [[NSNumber alloc] initWithInt:value]; return self; } - (id) initWithUnsignedInt:(unsigned int) value { typeCode = @encode(unsigned int); number = [[NSNumber alloc] initWithUnsignedInt:value]; return self; } - (id) initWithLong:(long) value { typeCode = @encode(long); number = [[NSNumber alloc] initWithLong:value]; return self; } - (id) initWithUnsignedLong:(unsigned long) value { typeCode = @encode(unsigned long); number = [[NSNumber alloc] initWithUnsignedLong:value]; return self; } - (id) initWithLongLong:(long long) value { typeCode = @encode(long long); number = [[NSNumber alloc] initWithLongLong:value]; return self; } - (id) initWithUnsignedLongLong:(unsigned long long) value { typeCode = @encode(unsigned long long); number = [[NSNumber alloc] initWithUnsignedLongLong:value]; return self; } - (id) initWithFloat:(float) value { typeCode = @encode(float); number = [[NSNumber alloc] initWithFloat:value]; return self; } - (id) initWithDouble:(double) value { typeCode = @encode(double); number = [[NSNumber alloc] initWithDouble:value]; return self; } - (id) initWithBool:(BOOL) value { typeCode = @encode(BOOL); number = [[NSNumber alloc] initWithBool:value]; return self; } - (void) dealloc { [number release]; } #pragma mark Class Method: "Creators" + (MCPNumber *) numberWithChar:(char) value { return [[[MCPNumber alloc] initWithChar:value] autorelease]; } + (MCPNumber *) numberWithUnsignedChar:(unsigned char) value { return [[[MCPNumber alloc] initWithUnsignedChar:value] autorelease]; } + (MCPNumber *) numberWithShort:(short) value { return [[[MCPNumber alloc] initWithShort:value] autorelease]; } + (MCPNumber *) numberWithUnsignedShort:(unsigned short) value { return [[[MCPNumber alloc] initWithUnsignedShort:value] autorelease]; } + (MCPNumber *) numberWithInt:(int) value { return [[[MCPNumber alloc] initWithInt:value] autorelease]; } + (MCPNumber *) numberWithUnsignedInt:(unsigned int) value { return [[[MCPNumber alloc] initWithUnsignedInt:value] autorelease]; } + (MCPNumber *) numberWithLong:(long) value { return [[[MCPNumber alloc] initWithLong:value] autorelease]; } + (MCPNumber *) numberWithUnsignedLong:(unsigned long) value { return [[[MCPNumber alloc] initWithUnsignedLong:value] autorelease]; } + (MCPNumber *) numberWithLongLong:(long long) value { return [[[MCPNumber alloc] initWithLongLong:value] autorelease]; } + (MCPNumber *) numberWithUnsignedLongLong:(unsigned long long) value { return [[[MCPNumber alloc] initWithUnsignedLongLong:value] autorelease]; } + (MCPNumber *) numberWithFloat:(float) value { return [[[MCPNumber alloc] initWithFloat:value] autorelease]; } + (MCPNumber *) numberWithDouble:(double) value { return [[[MCPNumber alloc] initWithDouble:value] autorelease]; } + (MCPNumber *) numberWithBool:(BOOL) value { return [[[MCPNumber alloc] initWithBool:value] autorelease]; } #pragma mark NSValue primitive methods - (const char *) objCType { return typeCode; } - (void) getValue:(void *) buffer { [number getValue:buffer]; } /* - (NSString *) descriptionWithLocale:(NSDictionary *) aLocale // Not Primitive, but buggy... { NSString *theFormat; unsigned int theSize; void *theBuffer; NSString *theRet; switch (typeCode[0]) { // case @encode(unsigned long long) : PROBLEM @encode returns a POINTER to a char...(C string). case 'Q' : theFormat = @"%llu"; theSize = sizeof(unsigned long long); break; case 'L' : theFormat = @"%lu"; theSize = sizeof(unsigned long); break; default : return [number descriptionWithLocale:aLocale]; break; } theBuffer = malloc(theSize); [number getValue:theBuffer]; theRet = [[NSString alloc] initWithFormat:theFormat locale:aLocale arguments:theBuffer]; free(theBuffer); return [theRet autorelease]; } */ #pragma mark NSNumber primitive methods /* Reparing the absence of primitive methodes in NSNumber : */ - (char) charValue { return [number charValue]; } - (unsigned char) unsignedCharValue { return [number unsignedCharValue]; } - (short) shortValue { return [number shortValue]; } - (unsigned short) unsignedShortValue { return [number unsignedShortValue]; } - (int) intValue { return [number intValue]; } - (unsigned int) unsignedIntValue { return [number unsignedIntValue]; } - (long) longValue { return [number longValue]; } - (unsigned long) unsignedLongValue { return [number unsignedLongValue]; } - (long long) longLongValue { return [number longLongValue]; } - (unsigned long long) unsignedLongLongValue { return [number unsignedLongLongValue]; } - (float) floatValue { return [number floatValue]; } - (double) doubleValue { return [number doubleValue]; } - (BOOL) boolValue { return [number boolValue]; } @end Index: MCPConnection.h =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/MCPFoundationKit/MCPConnection.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MCPConnection.h 11 Oct 2003 20:32:25 -0000 1.2 --- MCPConnection.h 4 Aug 2004 23:24:06 -0000 1.3 *************** *** 42,49 **** @interface MCPConnection : NSObject { ! MYSQL *mConnection; /*"The inited MySQL connection"*/ ! BOOL mConnected; /*"Reflect the fact that the connection is already in place or not"*/ ! NSStringEncoding mEncoding; /*"The encoding used by MySQL server, to ISO-1 default"*/ ! unsigned int mConnectionFlags; /*"The flags to be used for the connection to the database."*/ } /*" --- 42,50 ---- @interface MCPConnection : NSObject { ! @protected ! MYSQL *mConnection; /*"The inited MySQL connection"*/ ! BOOL mConnected; /*"Reflect the fact that the connection is already in place or not"*/ ! NSStringEncoding mEncoding; /*"The encoding used by MySQL server, to ISO-1 default"*/ ! unsigned int mConnectionFlags; /*"The flags to be used for the connection to the database."*/ } /*" *************** *** 88,91 **** --- 89,93 ---- - (NSString *) prepareBinaryData:(NSData *) theData; - (NSString *) prepareString:(NSString *) theString; + - (NSString *) quoteObject:(id) theObject; - (MCPResult *) queryString:(NSString *) query; Index: MCPConnection.m =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/MCPFoundationKit/MCPConnection.m,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MCPConnection.m 14 May 2004 11:16:04 -0000 1.4 --- MCPConnection.m 4 Aug 2004 23:24:06 -0000 1.5 *************** *** 4,8 **** // // Created by serge cohen (ser...@m4...) on Sat Dec 08 2001. ! // Copyright (c) 2001 Serge Cohen. // // This code is free software; you can redistribute it and/or modify it under --- 4,8 ---- // // Created by serge cohen (ser...@m4...) on Sat Dec 08 2001. ! // Copyright (c) 2001 Serge Cohen. All rights reserved. // // This code is free software; you can redistribute it and/or modify it under *************** *** 27,33 **** #import "MCPConnection.h" #import "MCPResult.h" const unsigned int kMCPConnectionDefaultOption = CLIENT_COMPRESS; ! const char *kMCPConnectionDefaultSocket = MYSQL_UNIX_ADDR; const unsigned int kMCPConnection_Not_Inited = 1000; --- 27,34 ---- #import "MCPConnection.h" #import "MCPResult.h" + #import "MCPNumber.h" const unsigned int kMCPConnectionDefaultOption = CLIENT_COMPRESS; ! const char *kMCPConnectionDefaultSocket = MYSQL_UNIX_ADDR; const unsigned int kMCPConnection_Not_Inited = 1000; *************** *** 40,44 **** /*" !{ $Id$ } ! !{ $Name$ } 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. --- 41,45 ---- /*" !{ $Id$ } ! !{ $Author$ } 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. *************** *** 57,60 **** --- 58,65 ---- ... } + + #{NOTE} Failing to properly release your MCPConnection(s) object might cause a MySQL crash!!! (recovered if the + server was started using mysqld_safe). + "*/ *************** *** 122,126 **** { if (self = [MCPConnection class]) { ! [self setVersion:020203]; // Ma.Mi.Re -> MaMiRe } --- 127,131 ---- { if (self = [MCPConnection class]) { ! [self setVersion:020300]; // Ma.Mi.Re -> MaMiRe } *************** *** 419,422 **** --- 424,456 ---- + - (NSString *) quoteObject:(id) theObject + /*" Use the class of the theObject to know how it should be prepared for usage with the database. + If theObject is a string, this method will put single quotes to both its side and escape any necessary + character using prepareString: method. If theObject is NSData, the prepareBinaryData: method will be + used instead. + For NSNumber object, the number is just quoted, for calendar dates, the calendar date is formatted in + the preferred format for the database. + "*/ + { + if ([theObject isKindOfClass:[NSData class]]) { + return [NSString stringWithFormat:@"'%@'", [self prepareBinaryData:(NSData *) theObject]]; + } + if ([theObject isKindOfClass:[NSString class]]) { + return [NSString stringWithFormat:@"'%@'", [self prepareString:(NSString *) theObject]]; + } + if ([theObject isKindOfClass:[NSNumber class]]) { + return [NSString stringWithFormat:@"%@", theObject]; + } + if ([theObject isKindOfClass:[NSCalendarDate class]]) { + return [NSString stringWithFormat:@"'%@'", [(NSCalendarDate *)theObject descriptionWithCalendarFormat:@"%Y-%m-%d %H:%M:%S"]]; + } + if ((nil == theObject) || ([theObject isKindOfClass:[NSNull class]])) { + return @"NULL"; + } + // Default : quote as string: + return [NSString stringWithFormat:@"'%@'", [self prepareString:[theObject description]]]; + } + + - (MCPResult *) queryString:(NSString *) query /*" *************** *** 670,674 **** "*/ { ! return [NSNumber numberWithUnsignedInt:mysql_get_proto_info(mConnection)]; } --- 704,708 ---- "*/ { ! return [MCPNumber numberWithUnsignedInt:mysql_get_proto_info(mConnection)]; } Index: MCPFastQueries.m =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/MCPFoundationKit/MCPFastQueries.m,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MCPFastQueries.m 11 Oct 2003 18:48:07 -0000 1.1 --- MCPFastQueries.m 4 Aug 2004 23:24:06 -0000 1.2 *************** *** 41,45 **** /*" Send the query aQuery to the server and retrieve the row id if the table have a autoincrement column. ! Returns 0 if no have been inserted "*/ { --- 41,45 ---- /*" Send the query aQuery to the server and retrieve the row id if the table have a autoincrement column. ! Returns 0 if nothing have been inserted. "*/ { Index: MCPResult.h =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/MCPFoundationKit/MCPResult.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MCPResult.h 11 Oct 2003 18:48:07 -0000 1.1 --- MCPResult.h 4 Aug 2004 23:24:06 -0000 1.2 *************** *** 31,39 **** @interface MCPResult : NSObject { ! MYSQL_RES *mResult; /*"The MYSQL_RES structure of the C API"*/ ! NSArray *mNames; /*"An NSArray holding the name of the columns"*/ ! 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"*/ } /*" --- 31,40 ---- @interface MCPResult : NSObject { ! @protected ! MYSQL_RES *mResult; /*"The MYSQL_RES structure of the C API"*/ ! NSArray *mNames; /*"An NSArray holding the name of the columns"*/ ! 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"*/ } /*" *************** *** 78,81 **** --- 79,85 ---- - (NSDictionary *) fetchTypesAsDictionary; + - (unsigned int) fetchFlagsAtIndex:(unsigned int) index; + - (unsigned int) fetchFlagsForKey:(NSString *) key; + - (BOOL) isBlobAtIndex:(unsigned int) index; - (BOOL) isBlobForKey:(NSString *) key; Index: MCPResult.m =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/MCPFoundationKit/MCPResult.m,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MCPResult.m 4 Mar 2004 17:52:37 -0000 1.4 --- MCPResult.m 4 Aug 2004 23:24:06 -0000 1.5 *************** *** 27,30 **** --- 27,31 ---- #import "MCPConnection.h" #import "MCPNull.h" + #import "MCPNumber.h" #import "MCPResult.h" *************** *** 67,75 **** + (void) initialize /*" ! Initialize the class version to 2.0.0 "*/ { if (self = [MCPResult class]) { ! [self setVersion:020203]; // Ma.Mi.Re -> MaMiRe MCPYear0000 = [[NSCalendarDate dateWithTimeIntervalSinceReferenceDate:-63146822400.0] retain]; [MCPYear0000 setCalendarFormat:@"%Y"]; --- 68,76 ---- + (void) initialize /*" ! Initialize the class version to 2.3.0 "*/ { if (self = [MCPResult class]) { ! [self setVersion:020300]; // Ma.Mi.Re -> MaMiRe MCPYear0000 = [[NSCalendarDate dateWithTimeIntervalSinceReferenceDate:-63146822400.0] retain]; [MCPYear0000 setCalendarFormat:@"%Y"]; *************** *** 211,215 **** - (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 --- 212,216 ---- - (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 -indeed MCPNumber, to keep signedness-, NSString...). This method returned directly the #{mutable} object generated while going through all the columns *************** *** 258,262 **** else { char *theData = calloc(sizeof(char),theLengths[i]+1); ! char *theUselLess; memcpy(theData, theRow[i],theLengths[i]); theData[theLengths[i]] = '\0'; --- 259,263 ---- else { char *theData = calloc(sizeof(char),theLengths[i]+1); ! // char *theUselLess; memcpy(theData, theRow[i],theLengths[i]); theData[theLengths[i]] = '\0'; *************** *** 267,274 **** case FIELD_TYPE_INT24: case FIELD_TYPE_LONG: ! theCurrentObj = [NSNumber numberWithLong:atol(theData)]; break; case FIELD_TYPE_LONGLONG: theCurrentObj = [NSNumber numberWithLongLong:strtoq(theData, &theUselLess, 0)]; break; case FIELD_TYPE_DECIMAL: --- 268,289 ---- case FIELD_TYPE_INT24: case FIELD_TYPE_LONG: ! theCurrentObj = (theField[i].flags & UNSIGNED_FLAG) ? [MCPNumber numberWithUnsignedLong:strtoul(theData, NULL, 0)] : [MCPNumber numberWithLong:strtol(theData, NULL, 0)]; ! /* ! if (theField[i].flags & UNSIGNED_FLAG) { // Signed integer (32b or less) ! theCurrentObj = [NSNumber numberWithUnsignedLong:strtoul(theData, NULL, 0)]; ! } ! else { // Signed integer (32b or less) ! // theCurrentObj = [NSNumber numberWithLong:atol(theData)]; ! theCurrentObj = [NSNumber numberWithLong:strtol(theData, NULL, 0)]; ! } ! #warning Should check for UNSIGNED (using theField[i].flag UNSIGNED_FLAG) ! */ break; case FIELD_TYPE_LONGLONG: + theCurrentObj = (theField[i].flags & UNSIGNED_FLAG) ? [MCPNumber numberWithUnsignedLongLong:strtoull(theData, NULL, 0)] : [MCPNumber numberWithLongLong:strtoll(theData, NULL, 0)]; + /* theCurrentObj = [NSNumber numberWithLongLong:strtoq(theData, &theUselLess, 0)]; + #warning Should check for UNSIGNED (using theField[i].flag UNSIGNED_FLAG) + */ break; case FIELD_TYPE_DECIMAL: *************** *** 317,320 **** --- 332,339 ---- case FIELD_TYPE_LONG_BLOB: theCurrentObj = [NSData dataWithBytes:theData length:theLengths[i]]; + if (!(theField[i].flags & BINARY_FLAG)) { // It is TEXT and NOT BLOB... + theCurrentObj = [self stringWithText:theCurrentObj]; + } + //#warning Should check for TEXT (using theField[i].flag BINARY_FLAG) break; case FIELD_TYPE_SET: *************** *** 596,605 **** - (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. ! #{NOT YET IMPLEMENTED}, return YES for both BLOBs and TEXTs... ! "*/ { BOOL theRet; --- 615,678 ---- + - (unsigned int) fetchFlagsAtIndex:(unsigned int) index + /*" Return the MySQL flags of the column at the given index... Can be used to check if a number is signed or not... + "*/ + { + unsigned int theRet; + unsigned int theNumFields; + MYSQL_FIELD *theField; + + if (mResult == NULL) { + // If no results, give an empty array. Maybe it's better to give a nil pointer? + return (0); + } + + theNumFields = [self numOfFields]; + theField = mysql_fetch_fields(mResult); + if (index >= theNumFields) { + // Out of range... should raise an exception + theRet = 0; + } + else { + theRet = theField[index].flags; + } + return theRet; + } + + - (unsigned int) fetchFlagsForKey:(NSString *) key + { + unsigned int theRet; + unsigned int theNumFields, index; + MYSQL_FIELD *theField; + + if (mResult == NULL) { + // If no results, give an empty array. Maybe it's better to give a nil pointer? + return (0); + } + + if (mNames == NULL) { + [self fetchFieldsName]; + } + + theNumFields = [self numOfFields]; + theField = mysql_fetch_fields(mResult); + if ((index = [mNames indexOfObject:key]) == NSNotFound) { + // Non existent key... should raise an exception + theRet = 0; + } + else { + theRet = theField[index].flags; + } + return theRet; + } + - (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. ! #{DEPRECATED}, This method is not consistent with the C API which is supposed to return YES for BOTH text and blob (and BTW is also deprecated)... ! ! #{NOTE} That the current version handles properly TEXT, and returns those as NSString (and not NSData as it used to be). ! "*/ { BOOL theRet; *************** *** 624,628 **** case FIELD_TYPE_MEDIUM_BLOB: case FIELD_TYPE_LONG_BLOB: ! theRet = YES; break; default: --- 697,702 ---- case FIELD_TYPE_MEDIUM_BLOB: case FIELD_TYPE_LONG_BLOB: ! // theRet = YES; ! theRet = (theField[index].flags & BINARY_FLAG); break; default: *************** *** 638,642 **** Return YES if the field (by name) with the given index is a BLOB. It should be used to discriminates between BLOBs and TEXTs. ! #{NOT YET IMPLEMENTED}, return YES for both BLOBs and TEXTs... "*/ { --- 712,718 ---- Return YES if the field (by name) with the given index is a BLOB. It should be used to discriminates between BLOBs and TEXTs. ! #{DEPRECATED}, This method is not consistent with the C API which is supposed to return YES for BOTH text and blob (and BTW is also deprecated)... ! ! #{NOTE} That the current version handles properly TEXT, and returns those as NSString (and not NSData as it used to be). "*/ { *************** *** 666,670 **** case FIELD_TYPE_MEDIUM_BLOB: case FIELD_TYPE_LONG_BLOB: ! theRet = YES; break; default: --- 742,747 ---- case FIELD_TYPE_MEDIUM_BLOB: case FIELD_TYPE_LONG_BLOB: ! // theRet = YES; ! theRet = (theField[index].flags & BINARY_FLAG); break; default: *************** *** 679,683 **** - (NSString *) stringWithText:(NSData *) theTextData /*" ! Use the string encoding to convert the returned NSData to a string (for a Text field) "*/ { --- 756,760 ---- - (NSString *) stringWithText:(NSData *) theTextData /*" ! Use the string encoding to convert the returned NSData to a string (for a TEXT field) "*/ { Index: SMySQL.h =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/MCPFoundationKit/SMySQL.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SMySQL.h 11 Oct 2003 18:48:07 -0000 1.1 --- SMySQL.h 4 Aug 2004 23:24:06 -0000 1.2 *************** *** 32,35 **** --- 32,36 ---- #import <SMySQL/MCPResult.h> #import <SMySQL/MCPConnection.h> + #import <SMySQL/MCPNumber.h> #import <SMySQL/MCPResultPlus.h> #import <SMySQL/MCPFastQueries.h> Index: SMySQL_bundled.h =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/MCPFoundationKit/SMySQL_bundled.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SMySQL_bundled.h 11 Oct 2003 19:21:31 -0000 1.2 --- SMySQL_bundled.h 4 Aug 2004 23:24:06 -0000 1.3 *************** *** 32,35 **** --- 32,36 ---- #import <SMySQL_bundled/MCPResult.h> #import <SMySQL_bundled/MCPConnection.h> + #import <SMySQL_bundled/MCPNumber.h> #import <SMySQL_bundled/MCPResultPlus.h> #import <SMySQL_bundled/MCPFastQueries.h> Index: SMySQL_static.h =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/MCPFoundationKit/SMySQL_static.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SMySQL_static.h 11 Oct 2003 19:21:31 -0000 1.2 --- SMySQL_static.h 4 Aug 2004 23:24:07 -0000 1.3 *************** *** 32,35 **** --- 32,36 ---- #import <SMySQL_static/MCPResult.h> #import <SMySQL_static/MCPConnection.h> + #import <SMySQL_static/MCPNumber.h> #import <SMySQL_static/MCPResultPlus.h> #import <SMySQL_static/MCPFastQueries.h> |