Methods



afterLastRow

Abstract: position the internal index to be after the last row.
- (void)afterLastRow; 


beforeFirstRow

Abstract: position the internal index to be before the first row.
- (void)beforeFirstRow; 


curRowField

Abstract: returns field at fieldIndex of current row as an id (NSString, NSNumber, etc.).
- (id)curRowField:(int)fieldIndex; 

Result: object or nil if any problem occurs.

firstRow

Abstract: position the internal index to be on the first row.
- (void)firstRow; 


goRow

Abstract: To position the internal index to be on the specified row.
Note calling nextRow and previousRow will move the cursor up and down resp.
If you want to read row N: [conn goRow:N-1] and then [conn nextRow]
- (void)goRow:(int)rowIndex; 

Parameters

NameDescription
rowIndexwhere to position the internal index.

goRowRelative

Abstract: position the internal index to be on the specified row relatively to the current one.
nextRow and previousRow and equivalent to goRowRelative:1 and goRowRelative:-1 resp.
- (void)goRowRelative:(int)deltaIndex; 

Parameters

NameDescription
deltato add to internal row index. (If delta is negative we move backward).

isColumnNULL

- (BOOL)isColumnNULL:(int)fieldIndex; 

Result: YES if column at fieldIndex is NULL

lastRow

Abstract: position the internal index to be on the last row.
- (void)lastRow; 


nextRow

Abstract: position the internal index to be on the next row.
- (BOOL)nextRow; 

Result: YES if successful, NO if the current row is no more valid (after the last row).

previousRow

Abstract: position the internal index result to be on the previous row.
- (BOOL)previousRow; 

Result: YES if successful, NO if the current row is no more valid (before the first row).

resultAsDictionary

Abstract: returns a dictionnary [autorelease] build from result of last query
- (NSDictionary *)resultAsDictionary; 


resultAsDictionnary returns a dictionary structured as follows

<dict>
<key>columns/key>
<array>
<dict>
<key>name</key>
<string>columnTitle</string>
<key>typeName</key>
<string>columnTypeName</string>
<key>typeOid</key>
<integer>columnTypeOid</integer>
</dict>
...


</array> <key>fields/key> <array> <string>columnFieldValue</string> ...

</array> </dict>
Since PostgreSQL allows creation of new types, we don't provide yet an automatic conversion from the PostgreSQL type to the plist one.

NB
resultAsDictionary preserves the curRowIndex used by nextRow and previousRow methods
This means it can be used inside a
while ([psql nextRow]) {
...
}

loop as a debugging tool (for example if an error condition occurs dump the result as a dict in a file) without changing the behavior of the loop.


resultColumnCount

- (int)resultColumnCount; 

Result: the number of columns of latest executed command.

resultColumnName

- (const char *)resultColumnName:(int)col; 

Result: the name of the column at index col.

resultColumnType

- (Oid)resultColumnType:(int)col; 

Result: the type oid of the column at index col.

resultColumnTypeName

- (const char *)resultColumnTypeName:(int)col; 

Result: the name of the type of the column at index col.

resultRowAsArray

Abstract: returns current row as an array of NSObject
- (NSArray *)resultRowAsArray; 

Result: NSArray of field values of current row or nil if an error occurs.

resultTableName

Abstract: should return the name of the table of the column at index col in latest result.
Not yet supported byPostgreSQL.
- (const char *)resultTableName:(int)col; 

Result: "NOT_SUPPORTED_BY_POSTGRESQL"

rowsAffected

- (int)rowsAffected; 

Result: How many rows were affected by latest query executed (SELECT).

rowsAffectedByCommand

- (int)rowsAffectedByCommand; 

Result: how many rows were affected by latestquery executed (UPDATE, DELETE, INSERT).

(Last Updated 12/27/2002)