Skip to content

DBCDatabaseTableColumnInfo

parfeon edited this page Feb 7, 2012 · 2 revisions

#DBCDatabaseTableColumnInfo 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
[DBCDatabaseTableInformation1]:https://github.com/parfeon/DBConnect/wiki/DBCDatabase+Aliases#m13
[DBCDatabaseTableInformation2]:https://github.com/parfeon/DBConnect/wiki/DBCDatabase+Aliases#m14
Overview
This class holds information about single column of the table, which was retrieved as result of [tableInformation:error:][DBCDatabaseTableInformation1] or [tableInformation:forDatabase:error:][DBCDatabaseTableInformation2]
This class holds information about:

  • column sequence number
  • column name
  • column data type
  • whether the column was specified as 'NOT NULL' or not
  • column default value
  • whether the column was a part of the primary key or not

##Tasks
###DBCDatabaseTableColumnInfo initialization
+ columnInfoWithSequence:columnName:columnDataType:isNotNull:defaultValue:isPartOfThePrimaryKey:
- initColumnInfoWithSequence:columnName:columnDataType:isNotNull:defaultValue:isPartOfThePrimaryKey:
###DBCDatabaseTableColumnInfo properties
numberInSequence
name
type
isNotNull
defaultValue
isPartOfThePrimaryKey

##Properties

numberInSequence

This property stores information about column sequence number.

@property (nonatomic, readonly, getter = numberInSequence)int colIdx

Return value
Column sequence number.

Discussion
This number can be used to determine column position in row of other columns.

Top


name

This property stores information about column name.

@property (nonatomic, readonly, getter = name)NSString *colName

Return value
Column name.

Top


type

This property stores information about column defined data type.

@property (nonatomic, readonly, getter = type)NSString *colType

Return value
Column defined data type.

Discussion
This property stores data type, which was set when the table was created or altered.

Top


isNotNull

This property stores information whether the column should have NOT NULL value or not.

@property (nonatomic, readonly, getter = isNotNull)BOOL colNotNull

Return value
YES if the column has NOT NULL and should contain value, otherwise - NO.

Discussion
If YES, than your requests should specify value for this column or at least specify DEFAULT.

Top


defaultValue

This property stores information about column default value.

@property (nonatomic, readonly, getter = defaultValue)NSString *colDefValue

Return value
Default value.

Discussion
Default value will be assigned to the column in case user didn't provide data for the column.

Top


isPartOfThePrimaryKey

This property stores information whether the column is a part of the primary key or not.

@property (nonatomic, readonly, getter = isPartOfThePrimaryKey)BOOL colIsPartOfPK

Return value
YES if the column belongs to the primary key, otherwise - NO

Top

##Class methods

columnInfoWithSequence:columnName:columnDataType:isNotNull:defaultValue:isPartOfThePrimaryKey:

Create and initialize DBCDatabaseTableColumnInfo instance with sequence number, name and source path.

+ (id)columnInfoWithSequence:(int)columnNumber columnName:(NSString*)columnName 
              columnDataType:(NSString*)columnDataType isNotNull:(BOOL)isNotNull 
                defaultValue:(NSString*)defaultVallue isPartOfThePrimaryKey:(BOOL)isPartOfThePrimaryKey

Parameters
columnNumber
    Column sequence number.
columnName
    Column name.
columnDataType
    Column data type.
isNotNull
    If YES, than the column should be NOT NULL, otherwise - NO.
defaultVallue
    Default column value, if NULL was passed as a value.
isPartOfThePrimaryKey
    If YES, than the column is a part of the primary key.

Return value
Autoreleased DBCDatabaseTableColumnInfo instance.

Discussion
This method creates and initializes DBCDatabaseTableColumnInfo instance which stores information about single database attached/created at current database connection.

See Also
- initDatabaseInfoWithSequence:name:filePath:

Top

##Instance methods

initolumnInfoWithSequence:columnName:columnDataType:isNotNull:defaultValue:isPartOfThePrimaryKey:

Initialize DBCDatabaseTableColumnInfo instance with a sequence number, name and source path.

- (id)initColumnInfoWithSequence:(int)columnNumber columnName:(NSString*)columnName 
                  columnDataType:(NSString*)columnDataType isNotNull:(BOOL)isNotNull 
                    defaultValue:(NSString*)defaultVallue isPartOfThePrimaryKey:(BOOL)isPartOfThePrimaryKey

Parameters
columnNumber
    Column sequence number.
columnName
    Column name.
columnDataType
    Column data type.
isNotNull
    If YES, than the column should be NOT NULL, otherwise - NO.
defaultVallue
    Default column value, if NULL was passed as a value.
isPartOfThePrimaryKey
    If YES, than the column is a part of the primary key.

Return value
Initialized DBCDatabaseTableColumnInfo instance.

Discussion
This method creates and initializes DBCDatabaseTableColumnInfo instance which stores information about single database attached/created at current database connection.

See Also
+ databaseInfoWithSequence:name:filePath:

Top

Clone this wiki locally