SQLite3Result::fetchArray runs the query again. [O: Bug #64531 ]
Abierto
@SakiTakamachi ya está trabajando en esto.
Desde el 5/3/2024.
Bug
Extension: sqlite3
Status: Needs Triage
- Lenguaje dominante
- C
- Estrellas
- 40.4k
- Forks
- 8.1k
- Merge medio
- 2 d 13 h
- PR fusionados (30 d)
- 96
Descripción
Description
Already reported 11 years ago. Here: https://bugs.php.net/bug.php?id=64531
The following code:
<?php
$conn = new SQLite3('Log.sqlite', \SQLITE3_OPEN_READWRITE);
$res = $conn->query('CREATE TABLE myTable (id INTEGER PRIMARY KEY AUTOINCREMENT, a INTEGER, b INTEGER, c INTEGER)');
//$res = $conn->query('DELETE FROM myTable');
$res = $conn->query('INSERT INTO myTable VALUES (null, 1, 2, 3)'); // Inserts a row here (the null is an auto-incrementing PK).
$res->fetchArray(); // Inserts the *same* row data as above, again (with the next auto-incrementing PK number).
$res->fetchArray(); // And yet again...
$res = $conn->query('SELECT COUNT(id) FROM myTable');
$data = $res->fetchArray();
var_dump($data[0]);
Resulted in this output:
int(3)
But I expected this output instead:
int(1)
PHP Version
PHP 8.2
Operating System
Debian
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Evaluación
Este issue todavía no se ha evaluado.