ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roman Shtykh (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (IGNITE-10265) PDOStatement::rowCount returns 0
Date Thu, 15 Nov 2018 04:37:00 GMT

     [ https://issues.apache.org/jira/browse/IGNITE-10265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Roman Shtykh updated IGNITE-10265:
----------------------------------
    Description: 
How to reproduce:

{{
$ cat ~/odbc.php
<?php
 
try {
    echo PHP_EOL,PHP_EOL,"# Using PDO",PHP_EOL;
    $dbh = new PDO('odbc:DRIVER={ApacheIgnite};Server=127.0.0.1;PORT=10800');
    $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 
    $sql = 'SELECT * FROM "Person".Person';
    $statement = $dbh->prepare($sql);
    $statement->execute();
 
    $data = $statement->fetchAll();
 
    foreach($data as $row) {
        var_dump($row);
    }
 
    echo "array Count : " . count($data) . "\n";
    echo "rowCount : " . $statement->rowCount() . "\n";
 
} catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "\n";
    die();
}
 
$ php ~/odbc.php
 
# Using PDO
array(10) {
  ["ORGID"]=>
  string(1) "1"
  [0]=>
  string(1) "1"
  ["FIRSTNAME"]=>
  string(4) "John"
  [1]=>
  string(4) "John"
  ["LASTNAME"]=>
  string(3) "Doe"
  [2]=>
  string(3) "Doe"
  ["RESUME"]=>
  string(14) "Master Degree."
  [3]=>
  string(14) "Master Degree."
  ["SALARY"]=>
  string(4) "2200"
  [4]=>
  string(4) "2200"
}
・
・
・
array(10) {
  ["ORGID"]=>
  string(1) "2"
  [0]=>
  string(1) "2"
  ["FIRSTNAME"]=>
  string(4) "Mary"
  [1]=>
  string(4) "Mary"
  ["LASTNAME"]=>
  string(5) "Major"
  [2]=>
  string(5) "Major"
  ["RESUME"]=>
  string(16) "Bachelor Degree."
  [3]=>
  string(16) "Bachelor Degree."
  ["SALARY"]=>
  string(4) "1200"
  [4]=>
  string(4) "1200"
}
array Count : 6
rowCount : 0
}}

  was:
How to reproduce:
{{$ cat ~/odbc.php}}
{{<?php}}
 
{{try}} {{{}}
{{    }}{{echo}} {{PHP_EOL,PHP_EOL,}}{{"# Using PDO"}}{{,PHP_EOL;}}
{{    }}{{$dbh}} {{= }}{{new}} {{PDO(}}{{'odbc:DRIVER=\{ApacheIgnite};Server=127.0.0.1;PORT=10800'}}{{);}}
{{    }}{{$dbh}}{{->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);}}
 
{{    }}{{$sql}} {{= }}{{'SELECT * FROM "Person".Person'}}{{;}}
{{    }}{{$statement}} {{= }}{{$dbh}}{{->prepare(}}{{$sql}}{{);}}
{{    }}{{$statement}}{{->execute();}}
 
{{    }}{{$data}} {{= }}{{$statement}}{{->fetchAll();}}
 
{{    }}{{foreach}}{{(}}{{$data}} {{as}} {{$row}}{{) {}}
{{        }}{{var_dump(}}{{$row}}{{);}}
{{    }}{{}}}
 
{{    }}{{echo}} {{"array Count : "}} {{. }}{{count}}{{(}}{{$data}}{{) . }}{{"\n"}}{{;}}
{{    }}{{echo}} {{"rowCount : "}} {{. }}{{$statement}}{{->rowCount() . }}{{"\n"}}{{;}}
 
{{} }}{{catch}} {{(PDOException }}{{$e}}{{) {}}
{{    }}{{print}} {{"Error!: "}} {{. }}{{$e}}{{->getMessage() . }}{{"\n"}}{{;}}
{{    }}{{die}}{{();}}
{{}}}
 
{{$ php ~/odbc.php}}
 
{{# Using PDO}}
{{array}}{{(10) {}}
{{  }}{{[}}{{"ORGID"}}{{]=>}}
{{  }}{{string(1) }}{{"1"}}
{{  }}{{[0]=>}}
{{  }}{{string(1) }}{{"1"}}
{{  }}{{[}}{{"FIRSTNAME"}}{{]=>}}
{{  }}{{string(4) }}{{"John"}}
{{  }}{{[1]=>}}
{{  }}{{string(4) }}{{"John"}}
{{  }}{{[}}{{"LASTNAME"}}{{]=>}}
{{  }}{{string(3) }}{{"Doe"}}
{{  }}{{[2]=>}}
{{  }}{{string(3) }}{{"Doe"}}
{{  }}{{[}}{{"RESUME"}}{{]=>}}
{{  }}{{string(14) }}{{"Master Degree."}}
{{  }}{{[3]=>}}
{{  }}{{string(14) }}{{"Master Degree."}}
{{  }}{{[}}{{"SALARY"}}{{]=>}}
{{  }}{{string(4) }}{{"2200"}}
{{  }}{{[4]=>}}
{{  }}{{string(4) }}{{"2200"}}
{{}}}
{{・}}
{{・}}
{{・}}
{{array}}{{(10) {}}
{{  }}{{[}}{{"ORGID"}}{{]=>}}
{{  }}{{string(1) }}{{"2"}}
{{  }}{{[0]=>}}
{{  }}{{string(1) }}{{"2"}}
{{  }}{{[}}{{"FIRSTNAME"}}{{]=>}}
{{  }}{{string(4) }}{{"Mary"}}
{{  }}{{[1]=>}}
{{  }}{{string(4) }}{{"Mary"}}
{{  }}{{[}}{{"LASTNAME"}}{{]=>}}
{{  }}{{string(5) }}{{"Major"}}
{{  }}{{[2]=>}}
{{  }}{{string(5) }}{{"Major"}}
{{  }}{{[}}{{"RESUME"}}{{]=>}}
{{  }}{{string(16) }}{{"Bachelor Degree."}}
{{  }}{{[3]=>}}
{{  }}{{string(16) }}{{"Bachelor Degree."}}
{{  }}{{[}}{{"SALARY"}}{{]=>}}
{{  }}{{string(4) }}{{"1200"}}
{{  }}{{[4]=>}}
{{  }}{{string(4) }}{{"1200"}}
{{}}}
{{array}} {{Count}} {{: 6}}
{{rowCount : 0}}
 


> PDOStatement::rowCount returns 0
> --------------------------------
>
>                 Key: IGNITE-10265
>                 URL: https://issues.apache.org/jira/browse/IGNITE-10265
>             Project: Ignite
>          Issue Type: Bug
>          Components: odbc
>    Affects Versions: 2.6
>         Environment: CentOS, unixODBC
>            Reporter: Roman Shtykh
>            Priority: Major
>
> How to reproduce:
> {{
> $ cat ~/odbc.php
> <?php
>  
> try {
>     echo PHP_EOL,PHP_EOL,"# Using PDO",PHP_EOL;
>     $dbh = new PDO('odbc:DRIVER={ApacheIgnite};Server=127.0.0.1;PORT=10800');
>     $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
>  
>     $sql = 'SELECT * FROM "Person".Person';
>     $statement = $dbh->prepare($sql);
>     $statement->execute();
>  
>     $data = $statement->fetchAll();
>  
>     foreach($data as $row) {
>         var_dump($row);
>     }
>  
>     echo "array Count : " . count($data) . "\n";
>     echo "rowCount : " . $statement->rowCount() . "\n";
>  
> } catch (PDOException $e) {
>     print "Error!: " . $e->getMessage() . "\n";
>     die();
> }
>  
> $ php ~/odbc.php
>  
> # Using PDO
> array(10) {
>   ["ORGID"]=>
>   string(1) "1"
>   [0]=>
>   string(1) "1"
>   ["FIRSTNAME"]=>
>   string(4) "John"
>   [1]=>
>   string(4) "John"
>   ["LASTNAME"]=>
>   string(3) "Doe"
>   [2]=>
>   string(3) "Doe"
>   ["RESUME"]=>
>   string(14) "Master Degree."
>   [3]=>
>   string(14) "Master Degree."
>   ["SALARY"]=>
>   string(4) "2200"
>   [4]=>
>   string(4) "2200"
> }
> ・
> ・
> ・
> array(10) {
>   ["ORGID"]=>
>   string(1) "2"
>   [0]=>
>   string(1) "2"
>   ["FIRSTNAME"]=>
>   string(4) "Mary"
>   [1]=>
>   string(4) "Mary"
>   ["LASTNAME"]=>
>   string(5) "Major"
>   [2]=>
>   string(5) "Major"
>   ["RESUME"]=>
>   string(16) "Bachelor Degree."
>   [3]=>
>   string(16) "Bachelor Degree."
>   ["SALARY"]=>
>   string(4) "1200"
>   [4]=>
>   string(4) "1200"
> }
> array Count : 6
> rowCount : 0
> }}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message