[Mysql-cocoa-commits] CVS: SMySQL SMySQL.h,1.2.2.4,1.2.2.5 MCPConnection.m,1.1.2.5,1.1.2.6 MCPResult
Brought to you by:
sergecohen
From: Serge C. <ser...@us...> - 2002-06-12 16:20:43
|
Update of /cvsroot/mysql-cocoa/SMySQL In directory usw-pr-cvs1:/tmp/cvs-serv24173 Modified Files: Tag: version-2 SMySQL.h MCPConnection.m MCPResult.m MCPFastQueries.h MCPFastQueries.m Log Message: Fixed a bug: a project header was not set to public (MCPFastQueries). Added the method updateQuery: to the (MCPFastQueries) category Few fixes. Serge Cohen; MySQL Cocoa project, 2002-06-12. Index: SMySQL.h =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/SMySQL.h,v retrieving revision 1.2.2.4 retrieving revision 1.2.2.5 diff -C2 -d -r1.2.2.4 -r1.2.2.5 *** SMySQL.h 4 Jun 2002 07:57:44 -0000 1.2.2.4 --- SMySQL.h 12 Jun 2002 16:20:38 -0000 1.2.2.5 *************** *** 33,36 **** --- 33,37 ---- #import <SMySQL/MCPConnection.h> #import <SMySQL/MCPResultPlus.h> + #import <SMySQL/MCPFastQueries.h> #import "mysql.h" //#import <SMySQL/mysql.h> Index: MCPConnection.m =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/Attic/MCPConnection.m,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** MCPConnection.m 4 Jun 2002 07:57:44 -0000 1.1.2.5 --- MCPConnection.m 12 Jun 2002 16:20:38 -0000 1.1.2.6 *************** *** 386,391 **** /*" 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. "*/ { --- 386,392 ---- /*" 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). If no field are present in the result (like in an insert query), will return nil (!{difference from previous version implementation}). ! ! 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. Also if you want to include in your query a string containing any special character (\, ', " ...) then you should use #{prepareString}. "*/ { *************** *** 400,404 **** else { // NSLog (@"Query worked but gives no output\n"); ! [theResult init]; } } --- 401,406 ---- else { // NSLog (@"Query worked but gives no output\n"); ! // [theResult init]; ! return nil; } } Index: MCPResult.m =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/Attic/MCPResult.m,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** MCPResult.m 3 Jun 2002 13:39:24 -0000 1.1.2.4 --- MCPResult.m 12 Jun 2002 16:20:38 -0000 1.1.2.5 *************** *** 274,280 **** --- 274,282 ---- // 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"]; + [theCurrentObj setCalendarFormat:@"%Y-%m-%d %H:%M:%S"]; break; case FIELD_TYPE_DATE: theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithUTF8String:theData] calendarFormat:@"%Y-%m-%d"]; + [theCurrentObj setCalendarFormat:@"%Y-%m-%d"]; break; case FIELD_TYPE_TIME: *************** *** 282,289 **** 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: --- 284,293 ---- theCurrentObj = [NSString stringWithUTF8String:theData]; case FIELD_TYPE_DATETIME: ! theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithCString:theData] calendarFormat:@"%Y-%m-%d %H:%M:%S"]; ! [theCurrentObj setCalendarFormat:@"%Y-%m-%d %H:%M:%S"]; break; case FIELD_TYPE_YEAR: ! theCurrentObj = [NSCalendarDate dateWithString:[NSString stringWithCString:theData] calendarFormat:@"%Y"]; ! [theCurrentObj setCalendarFormat:@"%Y"]; break; case FIELD_TYPE_VAR_STRING: Index: MCPFastQueries.h =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/Attic/MCPFastQueries.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 *** MCPFastQueries.h 4 Jun 2002 07:57:44 -0000 1.1.2.2 --- MCPFastQueries.h 12 Jun 2002 16:20:38 -0000 1.1.2.3 *************** *** 33,36 **** --- 33,37 ---- "*/ - (my_ulonglong) insertQuery:(NSString *) aQuery; + - (my_ulonglong) updateQuery:(NSString *) aQuery; Index: MCPFastQueries.m =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/Attic/MCPFastQueries.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 *** MCPFastQueries.m 4 Jun 2002 07:57:44 -0000 1.1.2.2 --- MCPFastQueries.m 12 Jun 2002 16:20:38 -0000 1.1.2.3 *************** *** 37,41 **** - (my_ulonglong) insertQuery:(NSString *) aQuery /*" ! Send tyhe query aQuery to the server and retrieve the row id if the table have a autoincrement column. Returns 0 if no have been inserted "*/ --- 37,41 ---- - (my_ulonglong) insertQuery:(NSString *) aQuery /*" ! 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 "*/ *************** *** 43,46 **** --- 43,58 ---- [self queryString:aQuery]; return [self insertId]; + } + + + - (my_ulonglong) updateQuery:(NSString *) aQuery + /*" + Send the query aQuery to the server and retrieve the number of affected rows (should work with #{update}, #{delete}, #{insert} and #{select} type of queries). + + NB: This can also be used with a #{select} query if you are only interested in the number of row complying with the query; you'll get no chance to get the result from the query, except by sending the query again (with #{queryString:}) + "*/ + { + [self queryString:aQuery]; + return [self affectedRows]; } |