<commit_before>--TEST--
Test the fetch() method for different fetch orientations with PDO::ATTR_CURSOR set to scrollable.
--ENV--
PHPT_EXEC=true
--SKIPIF--
<?php require('skipif_mid-refactor.inc'); ?>
--FILE--
<?php
require_once("MsCommon_mid-refactor.inc");

try {
    $conn1 = connect();

    // Prepare test table
    $tableName = "pdo_test_table";
    createTable($conn1, $tableName, array(new ColumnMeta("int", "id", "NOT NULL PRIMARY KEY"), "val" => "varchar(10)"));
    insertRow($conn1, $tableName, array("id" => 1, "val" => "A"));
    insertRow($conn1, $tableName, array("id" => 2, "val" => "B"));
    insertRow($conn1, $tableName, array("id" => 3, "val" => "C"));

    // Query table and retrieve data
    $stmt1 = $conn1->prepare( "SELECT val FROM $tableName", array( PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL ));
    
    $stmt1->execute();  
    $row = $stmt1->fetch( PDO::FETCH_ASSOC, PDO::FETCH_ORI_LAST );
    if( $row[ 'val' ] != "C" ) {
        throw new Exception( "Not C" );
    }
    $row = $stmt1->fetch( PDO::FETCH_ASSOC, PDO::FETCH_ORI_PRIOR );
    if( $row[ 'val' ] != "B" ) {
        throw new Exception( "Not B" );
    }
    $row = $stmt1->fetch( PDO::FETCH_ASSOC, PDO::FETCH_ORI_PRIOR );
    if( $row[ 'val' ] != "A" ) {
        throw new Exception( "Not A" );
    }
    $row = $stmt1->fetch( PDO::FETCH_ASSOC, PDO::FETCH_ORI_PRIOR );
    if( $row[ 'val' ] != false ) {
        throw new Exception( "Not false" );<commit_msg>fix pdostatement_fetch_orientation.phpt<commit_after>--TEST--
Test the fetch() method for different fetch orientations with PDO::ATTR_CURSOR set to scrollable.
--ENV--
PHPT_EXEC=true
--SKIPIF--
<?php require('skipif_mid-refactor.inc'); ?>
--FILE--
<?php
require_once("MsCommon_mid-refactor.inc");

try {
    $conn1 = connect();

    // Prepare test table
    $tableName = "pdo_test_table";
    createTable($conn1, $tableName, array(new ColumnMeta("int", "id", "NOT NULL PRIMARY KEY", "none"), "val" => "varchar(10)"));
    insertRow($conn1, $tableName, array("id" => 1, "val" => "A"));
    insertRow($conn1, $tableName, array("id" => 2, "val" => "B"));
    insertRow($conn1, $tableName, array("id" => 3, "val" => "C"));

    // Query table and retrieve data
    $stmt1 = $conn1->prepare( "SELECT val FROM $tableName ORDER BY id", array( PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL ));
    
    $stmt1->execute();  
    $row = $stmt1->fetch( PDO::FETCH_ASSOC, PDO::FETCH_ORI_LAST );
    if( $row[ 'val' ] != "C" ) {
        throw new Exception( "Not C" );
    }
    $row = $stmt1->fetch( PDO::FETCH_ASSOC, PDO::FETCH_ORI_PRIOR );
    if( $row[ 'val' ] != "B" ) {
        throw new Exception( "Not B" );
    }
    $row = $stmt1->fetch( PDO::FETCH_ASSOC, PDO::FETCH_ORI_PRIOR );
    if( $row[ 'val' ] != "A" ) {
        throw new Exception( "Not A" );
    }
    $row = $stmt1->fetch( PDO::FETCH_ASSOC, PDO::FETCH_ORI_PRIOR );
    if( $row[ 'val' ] != false ) {
        throw new Exception( "Not false" );
{'fraction_non_alphanumeric': 0.20162932790224034, 'fraction_numerical': 0.011541072640868975, 'mean_word_length': 3.431578947368421, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7486598', 'n_tokens_mistral': 1152, 'n_tokens_neox': 1118, 'n_words': 257}