2017-01-10 22:59:16 +01:00
|
|
|
--TEST--
|
|
|
|
sqlsrv_fetch_array() using a scrollable cursor
|
|
|
|
--SKIPIF--
|
2017-11-08 00:31:55 +01:00
|
|
|
<?php require('skipif_versions_old.inc'); ?>
|
2017-01-10 22:59:16 +01:00
|
|
|
--FILE--
|
|
|
|
<?php
|
2017-11-08 00:31:55 +01:00
|
|
|
require_once('MsCommon.inc');
|
2017-01-10 22:59:16 +01:00
|
|
|
|
2017-10-04 23:22:56 +02:00
|
|
|
// connect
|
2017-11-08 00:31:55 +01:00
|
|
|
$conn = AE\connect();
|
|
|
|
$tableName = 'test012';
|
2017-01-10 22:59:16 +01:00
|
|
|
|
|
|
|
// Create table
|
2017-11-08 00:31:55 +01:00
|
|
|
$columns = array(new AE\ColumnMeta('VARCHAR(10)', 'ID'));
|
|
|
|
AE\createTable($conn, $tableName, $columns);
|
2017-01-10 22:59:16 +01:00
|
|
|
|
2017-11-08 00:31:55 +01:00
|
|
|
AE\insertRow($conn, $tableName, array("ID" => '1998.1'));
|
|
|
|
AE\insertRow($conn, $tableName, array("ID" => '-2004'));
|
|
|
|
AE\insertRow($conn, $tableName, array("ID" => '2016'));
|
|
|
|
AE\insertRow($conn, $tableName, array("ID" => '4.2EUR'));
|
2017-01-10 22:59:16 +01:00
|
|
|
|
|
|
|
// Fetch data
|
|
|
|
$query = "SELECT ID FROM $tableName";
|
2017-11-08 00:31:55 +01:00
|
|
|
$stmt = AE\executeQueryEx($conn, $query, array("Scrollable"=>"buffered"));
|
2017-01-10 22:59:16 +01:00
|
|
|
|
2017-10-04 23:22:56 +02:00
|
|
|
// Fetch first row
|
|
|
|
$row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC, SQLSRV_SCROLL_NEXT);
|
2017-01-10 22:59:16 +01:00
|
|
|
echo $row['ID']."\n";
|
|
|
|
|
|
|
|
// Fetch third row
|
2017-10-04 23:22:56 +02:00
|
|
|
$row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC, SQLSRV_SCROLL_ABSOLUTE, 2);
|
2017-01-10 22:59:16 +01:00
|
|
|
echo $row['ID']."\n";
|
|
|
|
|
|
|
|
// Fetch last row
|
2017-10-04 23:22:56 +02:00
|
|
|
$row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC, SQLSRV_SCROLL_LAST);
|
2017-01-10 22:59:16 +01:00
|
|
|
echo $row['ID']."\n";
|
|
|
|
|
2017-11-08 00:31:55 +01:00
|
|
|
dropTable($conn, $tableName);
|
|
|
|
|
2017-01-10 22:59:16 +01:00
|
|
|
sqlsrv_free_stmt($stmt);
|
|
|
|
sqlsrv_close($conn);
|
|
|
|
print "Done"
|
|
|
|
?>
|
|
|
|
|
|
|
|
--EXPECT--
|
|
|
|
1998.1
|
|
|
|
2016
|
|
|
|
4.2EUR
|
|
|
|
Done
|