[Mysql-cocoa-commits] CVS: SMySQL SMySQLResult.m,1.7,1.8
Brought to you by:
sergecohen
From: Serge C. <ser...@us...> - 2002-11-29 11:05:33
|
Update of /cvsroot/mysql-cocoa/SMySQL In directory sc8-pr-cvs1:/tmp/cvs-serv17781 Modified Files: SMySQLResult.m Log Message: Corrected error for FIELD_TYPE_DATE, pointed out by moxou <mo...@ma...>. Serge Cohen; MySQL-Cocoa project 2002-11-29. Index: SMySQLResult.m =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/SMySQLResult.m,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SMySQLResult.m 3 Jun 2002 15:05:58 -0000 1.7 --- SMySQLResult.m 29 Nov 2002 11:05:24 -0000 1.8 *************** *** 233,238 **** 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 --- 233,238 ---- 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 *************** *** 240,256 **** // 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: --- 240,257 ---- // 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]; + break; 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: *************** *** 364,368 **** // 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; --- 365,370 ---- // Pass them back as string for the moment... not TIME object in Cocoa (so far) theCurrentObj = [NSString stringWithUTF8String:theData]; ! break; ! case FIELD_TYPE_DATETIME: theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithUTF8String:theData] calendarFormat:@"%Y-%m-%d %H:%M:%S"]; break; |