facebook / facebook/hhvm

PDO::FETCH_LAZY not supported by pgsql on hhvm

Open
#7,695 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
18.7k
Forks
3.1k
Avg merge
1h 47m
Merged PRs (30d)
2

Description

The pgsql extension in hhvm core does not support FETCH_LAZY (and I am not sure whether other drivers support it). With FETCH_LAZY, you can iterate through the `$stmt` object to retrieve each row as an object. For example, the CakePHP 2 framework internals use this pattern - you can patch the framework to do things in an HHVM-supported manner, but not sure if doing so would cause other problems.

### HHVM Version

2017.01.04~xenial

### Standalone code, or other way to reproduce the problem

```
prepare("SELECT generate_series(1, 5) AS foo;");

$stmt->setFetchMode(PDO::FETCH_LAZY);

$stmt->execute(array());

foreach($stmt as $r) {
echo $r->foo . "\n";
}
```

### Expected result

Should print

```
1
2
3
4
5
```

### Actual result

```

Notice: Cannot access property on non-object in /home/foo/test_query.php on line 13

```
(repeated 5 times)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.