postgreSQL.cursor.fetchOneRow

Syntax

postgreSQL.cursor.fetchOneRow (cursorRef, adrRow, as, flCoerceToUserTalkTypes)

Params

cursorRef is a reference to a cursor as returned by postgreSQL.cursor.create.

adrRow is the address of the variable where the result will be stored.

as is an optional string4 value indicating the desired result type. Default is listType.

flCoerceToUserTalkTypes is an optional boolean indicating whether PostgreSQL values in the row should be converted to corresponding UserTalkTypes. Default is true.

Action

Fetch the current row from the last result set generated by a query or procedure call, and increment the internal row position to point at the next row.

Returns

A boolean that is true if a row was fetched, or false if there are no more rows waiting to be fetched.

Examples

postgreSQL.cursor.fetchOneRow (cursorRef, @row)

« true //row now contains e.g. {"Bull", "Mancuso", 41}

while postgreSQL.cursor.fetchOneRow (cursorRef, @row, recordType) //loop over all rows

dialog.notify (row) //display every row record to the user

Notes

If the specified result type is listType, adrRow will point to a list containing the cells from the current row in the same order they appear in the result set returned by the server. If the specified result type is recordType, adrRow will point to a record containing the cells from the current row with the result set's column names serving as item names in the record. These are the only two result types currently supported.

Values contained in the returned list or record will be converted from PostgreSQL data types to corresponding UserTalk data types. The SQL NULL value will be converted to the UserTalk nil value. The TIME type will be converted to dateType with the date part set to January 1st, 1904. The TIME type will be converted to dateType with the time part set to midnight. The INTERVAL type will be converted to a numberType containing the equivalent number of seconds. PostgreSQL types for which no special conversion rules have been hard-coded in the extension will be returned as strings.

For the data type conversion to work correctly, the PostgreSQL extension automatically sets the date style for each connection to ISO, and you should refrain from changing it, e.g. by running a SET DATESTYLE command over the connection.

If flCoerceToUserTalkTypes is false, all values will be returned as strings, unchanged from how they have been received from the database server.

If the last query or procedure call did not generate a result set or if no query or procedure call has been run yet, this verb generates a script error.

See Also

postgreSQL.cursor.executeQuery

postgreSQL.cursor.executeMultipleQueries

postgreSQL.cursor.callProcedure

postgreSQL.cursor.getDescription

postgreSQL.cursor.fetchMultipleRows

postgreSQL.cursor.fetchAllRows