Skip to content

DBCDatabaseRow

parfeon edited this page Feb 7, 2012 · 2 revisions

#DBCDatabaseRow Class Reference
[SQLitews]:http://www.sqlite.org
[APPLFastEnumerationProtocol]:http://developer.apple.com/library/ios/#documentation/cocoa/reference/NSFastEnumeration_protocol/Reference/NSFastEnumeration.html [DBCDatabaseResultCR]:https://github.com/parfeon/DBConnect/wiki/DBCDatabaseResult
[DBCDatabaseCR]:https://github.com/parfeon/DBConnect/wiki/DBCDatabase
[DBCDatabaseBasicExample]:https://github.com/parfeon/DBConnect/wiki/DBCDatabase#basicExample
[DBCDatabaseExecuteQuery]:https://github.com/parfeon/DBConnect/wiki/DBCDatabase#m12
Overview
This class holds data from single database entry returned as result of [executeQuery:error:][DBCDatabaseExecuteQuery].
This class holds information about:

  • columns count
  • list of values for each of columns

##Tasks
###DBCDatabaseRow initialization
+ rowWithStatement:dataStructureDelegate:
- initRowWithStatement:dataStructureDelegate:
###DBCDatabaseRow misc
- columnsCount
- dataTypeClassAtColumnIndex:
- dataTypeClassForColumn:
###DBCDatabaseResult data getters
- intForColumn:
- intForColumnAtIndex:
- integerForColumn:
- integerForColumnAtIndex:
- unsignedIntegerForColumn:
- unsignedIntegerForColumnAtIndex:
- longForColumn:
- longForColumnAtIndex:
- longLongForColumn:
- longLongForColumnAtIndex:
- boolForColumn:
- boolForColumnAtIndex:
- floatForColumn:
- floatForColumnAtIndex:
- doubleForColumn:
- doubleForColumnAtIndex:
- objectForColumn:
- objectForColumnAtIndex:
- stringForColumn:
- stringForColumnAtIndex:
- dateForColumn:
- dateForColumnAtIndex:
- dataForColumn:
- dataForColumnAtIndex:

##Class methods

rowWithStatement:dataStructureDelegate:

Create and initialize DBCDatabaseRow instance with specified SQL statement and data structure delegate.

+ (id)rowWithStatement:(sqlite3_stmt*)statement dataStructureDelegate:(id)dsDelegate

Parameters
statement
    [SQLite][SQLitews] statement which is used for query.
dsDelegate
    Delegate which implements DBCDatabaseResultStructure protocol which is a part of [DBCDatabaseResult][DBCDatabaseResultCR].

Return value
Autoreleased DBCDatabaseRow instance.

Discussion
This method creates and initialize DBCDatabaseRow instance, which is ready to use by DBCDatabaseResult.
This method as initRowWithStatement:dataStructureDelegate: also makes type checking to determine real data type for value stored in columns and compares it with one provided by [structure delegate][DBCDatabaseResultCR]. This class will always use real data type for data stored in columns.

See Also
- initRowWithStatement:dataStructureDelegate:

Top

##Instance methods

initRowWithStatement:dataStructureDelegate:

Initialize DBCDatabaseRow instance with specified SQL statement and data structure delegate.

- (id)initRowWithStatement:(sqlite3_stmt*)statement dataStructureDelegate:(id)dsDelegate

Parameters
statement
    [SQLite][SQLitews] statement which used for query.
dsDelegate
    Delegate which implements DBCDatabaseResultStructure protocol which is a part of [DBCDatabaseResult][DBCDatabaseResultCR].

Return value
Initialized DBCDatabaseRow instance.

Discussion
This method initialize DBCDatabaseRow instance, which is ready to use by DBCDatabaseResult.
This method as rowWithStatement:dataStructureDelegate: also makes type checking to determine real data type for value stored in columns and compares it with one provided by [structure delegate][DBCDatabaseResultCR]. This class always will use real data type for data stored in columns.

See Also
+ rowWithStatement:dataStructureDelegate:

Top


columnsCount

This method allows you to retrieve number of columns, returned as a response for last query execution.

- (int)columnsCount

Return value
Number of columns returned as a response for last query execution.

See Also
- dataTypeClassAtColumnIndex:
- dataTypeClassForColumn:

Top


dataTypeClassAtColumnIndex:

This method allows you to retrieve real data type for data stored in specific column by it's index.

- (Class)dataTypeClassAtColumnIndex:(int)columnIdx

Parameters
columnIdx
    Index of the column which holds data.

Return value
Class which represents stored data object.

See Also
- columnsCount
- dataTypeClassForColumn:

Top


dataTypeClassForColumn:

This method allows you to retrieve real data type for data stored in specific column by it's name.

- (Class)dataTypeClassForColumn:(NSString*)columnName

Parameters
columnName
    Name of the column which holds data.

Return value
Class which represents stored data object.

See Also
- columnsCount
- dataTypeClassAtColumnIndex:

Top


intForColumn:

This method allows you to retrieve int value for column by its name.

- (int)intForColumn:(NSString*)columnName

Parameters
columnName
    Name of the column which stores data.

Return value
int value for value stored in specified column.

See Also
- intForColumnAtIndex:
- integerForColumn:
- integerForColumnAtIndex:
- unsignedIntegerForColumn:
- unsignedIntegerForColumnAtIndex:

Top


intForColumnAtIndex:

This method allows you to retrieve int value for column by its index.

- (int)intForColumnAtIndex:(int)columnIdx

Parameters
columnIdx
    Index of the column which stores data.

Return value
int value for value stored in specified column.

See Also
- intForColumn:
- integerForColumn:
- integerForColumnAtIndex:
- unsignedIntegerForColumn:
- unsignedIntegerForColumnAtIndex:

Top


integerForColumn:

This method allows you to retrieve integer value for column by its name.

- (NSInteger)integerForColumn:(NSString*)columnName

Parameters
columnName
    Name of the column which stores data.

Return value
integer value for value stored in specified column.

See Also
- intForColumn:
- intForColumnAtIndex:
- integerForColumnAtIndex:
- unsignedIntegerForColumn:
- unsignedIntegerForColumnAtIndex:

Top


integerForColumnAtIndex:

This method allows you to retrieve integer value for column by its index.

- (NSInteger)integerForColumnAtIndex:(int)columnIdx

Parameters
columnIdx
    Index of the column which stores data.

Return value
integer value for value stored in specified column.

See Also
- intForColumn:
- intForColumnAtIndex:
- integerForColumn:
- unsignedIntegerForColumn:
- unsignedIntegerForColumnAtIndex:

Top


unsignedIntegerForColumn:

This method allows you to retrieve unsigned integer value for column by its name.

- (NSUInteger)unsignedIntegerForColumn:(NSString*)columnName

Parameters
columnName
    Name of the column which stores data.

Return value
unsigned integer value for value stored in specified column.

See Also
- intForColumn:
- intForColumnAtIndex:
- integerForColumn:
- integerForColumnAtIndex:
- unsignedIntegerForColumnAtIndex:

Top


unsignedIntegerForColumnAtIndex:

This method allows you to retrieve unsigned integer value for column by its index.

- (NSUInteger)unsignedIntegerForColumnAtIndex:(int)columnIdx

Parameters
columnIdx
    Index of the column which stores data.

Return value
unsigned integer value for value stored in specified column.

See Also
- intForColumn:
- intForColumnAtIndex:
- integerForColumn:
- integerForColumnAtIndex:
- unsignedIntegerForColumn:

Top


longForColumn:

This method allows you to retrieve long value for column by its name.

- (long)longForColumn:(NSString*)columnName

Parameters
columnName
    Name of the column which stores data.

Return value
long value for value stored in specified column.

See Also
- longForColumnAtIndex:
- longLongForColumn:
- longLongForColumnAtIndex:

Top


longForColumnAtIndex:

This method allows you to retrieve long value for column by its index.

- (long)longForColumnAtIndex:(int)columnIdx

Parameters
columnIdx
    Index of the column which stores data.

Return value
long value for value stored in specified column.

See Also
- longForColumn:
- longLongForColumn:
- longLongForColumnAtIndex:

Top


longLongForColumn:

This method allows you to retrieve long long value for column by its name.

- (long long)longLongForColumn:(NSString*)columnName

Parameters
columnName
    Name of the column which stores data.

Return value
long long value for value stored in specified column.

See Also
- longForColumn:
- longForColumnAtIndex:
- longLongForColumnAtIndex:

Top


longLongForColumnAtIndex:

This method allows you to retrieve long long value for column by its index.

- (long long)longLongForColumnAtIndex:(int)columnIdx

Parameters
columnIdx
    Index of the column which stores data.

Return value
long long value for value stored in specified column.

See Also
- longForColumn:
- longForColumnAtIndex:
- longLongForColumn:

Top


boolForColumn:

This method allows you to retrieve bool value for column by its name.

- (BOOL)boolForColumn:(NSString*)columnName

Parameters
columnName
    Name of the column which stores data.

Return value
bool value for value stored in specified column.

See Also
- boolForColumnAtIndex:

Top


boolForColumnAtIndex:

This method allows you to retrieve bool value for column by its index.

- (BOOL)boolForColumnAtIndex:(int)columnIdx

Parameters
columnIdx
    Index of the column which stores data.

Return value
bool value for value stored in specified column.

See Also
- boolForColumn:

Top


floatForColumn:

This method allows you to retrieve bool value for column by its name.

- (float)floatForColumn:(NSString*)columnName

Parameters
columnName
    Name of the column which stores data.

Return value
float value for value stored in specified column.

See Also
- floatForColumnAtIndex:
- doubleForColumn:
- doubleForColumnAtIndex:

Top


floatForColumnAtIndex:

This method allows you to retrieve float value for column by its index.

- (float)floatForColumnAtIndex:(int)columnIdx

Parameters
columnIdx
    Index of the column which stores data.

Return value
float value for value stored in specified column.

See Also
- floatForColumn:
- doubleForColumn:
- doubleForColumnAtIndex:

Top


doubleForColumn:

This method allows you to retrieve double value for column by its name.

- (double)doubleForColumn:(NSString*)columnName

Parameters
columnName
    Name of the column which stores data.

Return value
double value for value stored in specified column.

See Also
- floatForColumn:
- floatForColumnAtIndex:
- doubleForColumnAtIndex:

Top


doubleForColumnAtIndex:

This method allows you to retrieve double value for column by its index.

- (double)doubleForColumnAtIndex:(int)columnIdx

Parameters
columnIdx
    Index of the column which stores data.

Return value
double value for value stored in specified column.

See Also
- floatForColumn:
- floatForColumnAtIndex:
- doubleForColumn:

Top


objectForColumn:

This method allows you to retrieve id value for column by its name.

- (id)objectForColumn:(NSString*)columnName

Parameters
columnName
    Name of the column which stores data.

Return value
id value for value stored in specified column.

See Also
- objectForColumnAtIndex:
- stringForColumn:
- stringForColumnAtIndex:
- dateForColumn:
- dateForColumnAtIndex:
- dataForColumn:
- dataForColumnAtIndex:

Top


objectForColumnAtIndex:

This method allows you to retrieve id value for column by its index.

- (id)objectForColumnAtIndex:(int)columnIdx

Parameters
columnIdx
    Index of the column which stores data.

Return value
id value for value stored in specified column.

See Also
- objectForColumn:
- stringForColumn:
- stringForColumnAtIndex:
- dateForColumn:
- dateForColumnAtIndex:
- dataForColumn:
- dataForColumnAtIndex:

Top


stringForColumn:

This method allows you to retrieve NSString value for column by its name.

- (NSString*)stringForColumn:(NSString*)columnName

Parameters
columnName
    Name of the column which stores data.

Return value
NSString value for value stored in specified column.

See Also
- objectForColumn:
- objectForColumnAtIndex:
- stringForColumnAtIndex:
- dateForColumn:
- dateForColumnAtIndex:
- dataForColumn:
- dataForColumnAtIndex:

Top


stringForColumnAtIndex:

This method allows you to retrieve NSString value for column by its index.

- (NSString*)stringForColumnAtIndex:(int)columnIdx

Parameters
columnIdx
    Index of the column which stores data.

Return value
NSString value for value stored in specified column.

See Also
- objectForColumn:
- objectForColumnAtIndex:
- stringForColumn:
- dateForColumn:
- dateForColumnAtIndex:
- dataForColumn:
- dataForColumnAtIndex:

Top


dateForColumn:

This method allows you to retrieve NSDate value for column by its name.

- (NSDate*)dateForColumn:(NSString*)columnName

Parameters
columnName
    Name of the column which stores data.

Return value
NSDate value for value stored in specified column.

See Also
- objectForColumn:
- objectForColumnAtIndex:
- stringForColumn:
- stringForColumnAtIndex:
- dateForColumnAtIndex:
- dataForColumn:
- dataForColumnAtIndex:

Top


dateForColumnAtIndex:

This method allows you to retrieve NSDate value for column by its index.

- (NSDate*)dateForColumnAtIndex:(int)columnIdx

Parameters
columnIdx
    Index of the column which stores data.

Return value
NSDate value for value stored in specified column.

See Also
- objectForColumn:
- objectForColumnAtIndex:
- stringForColumn:
- stringForColumnAtIndex:
- dateForColumn:
- dataForColumn:
- dataForColumnAtIndex:

Top


dataForColumn:

This method allows you to retrieve NSData value for column by its name.

- (NSData*)dataForColumn:(NSString*)columnName

Parameters
columnName
    Name of the column which stores data.

Return value
NSData value for value stored in specified column.

See Also
- objectForColumn:
- objectForColumnAtIndex:
- stringForColumn:
- stringForColumnAtIndex:
- dateForColumn:
- dateForColumnAtIndex:
- dataForColumnAtIndex:

Top


dataForColumnAtIndex:

This method allows you to retrieve NSData value for column by its index.

- (NSData*)dataForColumnAtIndex:(int)columnIdx

Parameters
columnIdx
    Index of the column which stores data.

Return value
NSData value for value stored in specified column.

See Also
- objectForColumn:
- objectForColumnAtIndex:
- stringForColumn:
- stringForColumnAtIndex:
- dateForColumn:
- dateForColumnAtIndex:
- dataForColumn:

Top

Clone this wiki locally