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

SQL Anywhere 11.0.1 (中文) » SQL Anywhere 服务器 - 编程 » SQL Anywhere 数据访问 API » SQL Anywhere for Ruby » SQL Anywhere Ruby API

 

sqlany_fetch_absolute

将结果集中的当前行移动到指定的行编号处,然后读取该行的数据。

语法
sqlany_fetch_absolute ( $stmt, $row_num )
参数
  • $stmt   由 sqlany_execute 或 sqlany_execute_direct 执行的语句对象。

  • $row_num   要读取的行编号。第一行为 1,最后一行为 -1。

返回值

返回标量值,成功时为 1,不成功时为 0。

另请参见
示例
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"