[jira] [Comment Edited] (IGNITE-10265) PDOStatement::rowCount returns 0

2018-11-19 Thread Roman Shtykh (JIRA)


[ 
https://issues.apache.org/jira/browse/IGNITE-10265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16692527#comment-16692527
 ] 

Roman Shtykh edited comment on IGNITE-10265 at 11/20/18 1:53 AM:
-

I would leave it as "Wish" as Albert suggested. It works, for instance, for 
MySQL (and that's what users might expect too from Ignite)

{noformat}
$ cat mysql.php
prepare('SELECT * FROM weather limit 10');
if ($stmt->execute()) {
$data = $stmt->fetchAll();
var_dump(count($data));
}

var_dump($stmt->rowCount());
} catch (Exception $e) {
}

$ php mysql.php
int(10)
int(10)
{noformat}

What do you think?


was (Author: roman_s):
I would leave it as "Wish" as Albert suggested. It works, for instance, for 
MySQL (and that's what users might expect too from Ignite)

{noformat}
$ cat mysql.php
prepare('SELECT * FROM weather limit 10');
if ($stmt->execute()) {
$data = $stmt->fetchAll();
var_dump(count($data));
}

var_dump($stmt->rowCount());
} catch (Exception $e) {
}

$ php mysql.php
int(10)
int(10)
{noformat}

> PDOStatement::rowCount returns 0
> 
>
> Key: IGNITE-10265
> URL: https://issues.apache.org/jira/browse/IGNITE-10265
> Project: Ignite
>  Issue Type: Wish
>  Components: odbc
>Affects Versions: 2.6
> Environment: CentOS, unixODBC
>Reporter: Roman Shtykh
>Assignee: Igor Sapego
>Priority: Minor
>
> How to reproduce:
> {noformat}
> $ cat ~/odbc.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
> {noformat}



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


[jira] [Comment Edited] (IGNITE-10265) PDOStatement::rowCount returns 0

2018-11-20 Thread Igor Sapego (JIRA)


[ 
https://issues.apache.org/jira/browse/IGNITE-10265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16693008#comment-16693008
 ] 

Igor Sapego edited comment on IGNITE-10265 at 11/20/18 10:21 AM:
-

[~roman_s], anyway, this is not ODBC but SQL feature. And I doubt it will ever 
be implemented in SQL as it will kill performance.


was (Author: isapego):
[~roman_s], anyway, this is not ODBC but SQL feature. And I doubt it will ever 
be implemented in SQL as it is going to kill performance.

> PDOStatement::rowCount returns 0
> 
>
> Key: IGNITE-10265
> URL: https://issues.apache.org/jira/browse/IGNITE-10265
> Project: Ignite
>  Issue Type: Wish
>  Components: odbc
>Affects Versions: 2.6
> Environment: CentOS, unixODBC
>Reporter: Roman Shtykh
>Assignee: Igor Sapego
>Priority: Minor
>
> How to reproduce:
> {noformat}
> $ cat ~/odbc.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
> {noformat}



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