MCPConnection (MCPFastQueries)


Declared In:
MCPFastQueries.h


Category Description

$Id: MCPFastQueries.m,v 1.2 2004/08/04 23:24:06 sergecohen Exp $

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.


Method Types

For insert queries, get directly the Id of the newly inserted row
- insertQuery:
- updateQuery:
Returns directly a proper NS object, or a collection (NSArray, NSDictionary...).
- getFirstFieldFromQuery:
- getFirstRowFromQuery:asType:
- getAllRowsFromQuery:asType:
- getQuery:colWithIndex:
- getQuery:colWithName:

Instance Methods

getAllRowsFromQuery:asType:

- (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:.


getFirstFieldFromQuery:

- (id)getFirstFieldFromQuery:(NSString *)aQuery

Get the first field of the first row of the result from the query (aQuery). Should return nil if no object at all are selected.


getFirstRowFromQuery:asType:

- (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)


getQuery:colWithIndex:

- (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.


getQuery:colWithName:

- (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.


insertQuery:

- (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 nothing have been inserted.


updateQuery:

- (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:)


Version 1.1 Copyright ©2003 by Serge Cohen. All Rights Reserved. Mon Aug 09 11:00:26 2004