Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (Français) » SQL Anywhere Server - Programming » SQL Anywhere Data Access APIs » SQL Anywhere for Ruby » SQL Anywhere Ruby API

 

sqlany_fetch_absolute

Moves the current row in the result set to the row number specified and then fetches the data at that row.

Syntax
sqlany_fetch_absolute ( $stmt, $row_num )
Parameters
  • $stmt   A statement object that was executed by sqlany_execute or sqlany_execute_direct.

  • $row_num   The row number to be fetched. The first row is 1, the last row is -1.

Returns

Returns a scalar value that is 1 on success or 0 on failure.

See also
Example
stmt = api.sqlany_execute_direct( conn, "SELECT * FROM Employees" )
# Fetch the second row
rc = api.sqlany_fetch_absolute( stmt, 2 )
rc, employeeID = api.sqlany_get_column( stmt, 0 )
rc, managerID  = api.sqlany_get_column( stmt, 1 )
rc, surname = api.sqlany_get_column( stmt, 2 )
rc, givenName = api.sqlany_get_column( stmt, 3 )
rc, departmentID = api.sqlany_get_column( stmt, 4 )
print employeeID, ",", managerID, ",",
     surname, ",", givenName, ",", departmentID, "\n"