FETCH_LAZY not properly supported for "long" columns
Open
Nobody has claimed this yet.
Bug
Extension: pdo_odbc
Status: Needs Triage
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
The following code:
<?php
const SIZE = 300;
$pdo = new PDO(DSN, USER, PASS);
$pdo->exec("CREATE TABLE gh9498 (name VARCHAR(" . SIZE . "))");
$pdo->exec("INSERT INTO gh9498 VALUES ('" . str_repeat("a", SIZE) . "')");
$statement = $pdo->prepare("SELECT * FROM gh9498");
$statement->execute();
$row = $statement->fetch(PDO::FETCH_LAZY);
var_dump($row);
var_dump($row);
Resulted in this output:
object(PDORow)#3 (2) {
["queryString"]=>
string(20) "SELECT * FROM gh9498"
["name"]=>
string(300) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
object(PDORow)#3 (2) {
["queryString"]=>
string(20) "SELECT * FROM gh9498"
["name"]=>
NULL
}
But I expected this output instead:
object(PDORow)#3 (2) {
["queryString"]=>
string(20) "SELECT * FROM gh9498"
["name"]=>
string(300) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
object(PDORow)#3 (2) {
["queryString"]=>
string(20) "SELECT * FROM gh9498"
["name"]=>
string(300) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
Obviously, accessing the row for the first time works as expected, but accessing it another time, does not. If SIZE < 256, accessing the row multiple times is properly supported.
PHP Version
PHP-8.0
Operating System
any
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the example with PDO::FETCH_LAZY and a value longer than 256 characters, then trace the PDO fetch path for repeated row access. Add a regression test covering the reported behavior; done means the long column remains available on the second access, matching the expected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100