[Mysql-cocoa-commits] CVS: SMySQL MCPFastQueries.h,NONE,1.1.2.1 MCPFastQueries.m,NONE,1.1.2.1 TO_DO,
Brought to you by:
sergecohen
From: Serge C. <ser...@us...> - 2002-06-03 14:11:54
|
Update of /cvsroot/mysql-cocoa/SMySQL In directory usw-pr-cvs1:/tmp/cvs-serv510 Modified Files: Tag: version-2 TO_DO Added Files: Tag: version-2 MCPFastQueries.h MCPFastQueries.m Log Message: Added the category MCPFastQueries to MCPConnection. Serge Cohen; MySQL Cocoa project, 2002-06-03. --- NEW FILE: MCPFastQueries.h --- // // MCPFastQueries.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: MCPFastQueries.h,v 1.1.2.1 2002/06/03 14:11:51 sergecohen Exp $ // $Author: sergecohen $ #import <Foundation/Foundation.h> #import "MCPConnection.h" @interface MCPConnection (MCPFastQueries) /*" Returns directly a proper NS object, or a collection (NSArray, NSDictionary...). "*/ - (id) getFirstFieldFromQuery:(NSString *) aQuery; - (id) getFirstRowFromQuery:(NSString *) aQuery asType:(MCPReturnType) aType; - (id) getAllRowsFromQuery:(NSString *) aQuery asType:(MCPReturnType) aType; - (NSArray *) getQuery:(NSString *) aQuery colWithIndex:(unsigned int) aCol; - (NSArray *) getQuery:(NSString *) aQuery colWithName:(NSString *) aColName; @end --- NEW FILE: MCPFastQueries.m --- // // MCPFastQueries.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: MCPFastQueries.m,v 1.1.2.1 2002/06/03 14:11:51 sergecohen Exp $ // $Author: sergecohen $ #import "MCPResultPlus.h" #import "MCPFastQueries.h" @implementation MCPConnection (MCPFastQueries) /*" This actegory is made up to keep the extra methods out or the core of the framework. Basicly this is the place to add methods which are useful, but are just wrappers to the methods of the core (MCPConnection, MCPResult). The purpous being to have a single line call available for current tasks which otherwise would need a couple of lines and object defined. "*/ - (id) getFirstFieldFromQuery:(NSString *) aQuery /*" Get the first field of the first row of the result from the query (aQuery). "*/ { MCPResult *theResult = [self queryString:aQuery]; return [[theResult fetchRowAsType:MCPTypeArray] objectAtIndex:0]; } - (id) getFirstRowFromQuery:(NSString *) aQuery asType:(MCPReturnType) aType /*" Get the firdst row of the result from the query aQuery, in a collection of type determined by aType (MCPTypeArray or MCPTypeDictionary) "*/ { MCPResult *theResult = [self queryString:aQuery]; return [theResult fetchRowAsType:aType]; } - (id) getAllRowsFromQuery:(NSString *) aQuery asType:(MCPReturnType) aType /*" Get a bidimensional table of the whole rows of the result from the query aQuery. The type of the result is choosen by aType, it can be (MCPTypeArray, MCPTypeDictionary, MCPTypeFlippedArray & MCPTypeFlippedDictionary). Description of the types can be found in method #{fetch2DResultAsType:}. "*/ { MCPResult *theResult = [self queryString:aQuery]; return [theResult fetch2DResultAsType:aType]; } - (NSArray *) getQuery:(NSString *) aQuery colWithIndex:(unsigned int) aCol /*" Get a column (as an NSArray) of the result from the query aQuery. The column is choosen from it's index, starting from 0. "*/ { MCPResult *theResult = [self queryString:aQuery]; return [theResult fetchColAtIndex:aCol]; } - (NSArray *) getQuery:(NSString *) aQuery colWithName:(NSString *) aColName /*" Get a column (as an NSArray) of the result from the query aQuery. The column is choosen from it's name. "*/ { MCPResult *theResult = [self queryString:aQuery]; return [theResult fetchColWithName:aColName]; } @end Index: TO_DO =================================================================== RCS file: /cvsroot/mysql-cocoa/SMySQL/Attic/TO_DO,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** TO_DO 3 Jun 2002 13:11:45 -0000 1.1.2.2 --- TO_DO 3 Jun 2002 14:11:51 -0000 1.1.2.3 *************** *** 3,8 **** ++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) -> Ok. --- 3,9 ---- ++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 : isNSNull (Being able to check if any object returned by SMySQL is a MCPNull) -> Ok. + ++++++ Indeed I used the NSNull class. |