swoole / ext-postgresql

🐘 Coroutine-based client for PostgreSQL
64 stars 21 forks source link

Fix query results without field names #61

Closed Yurunsoft closed 3 years ago

Yurunsoft commented 3 years ago
Co\run(function () {
    $db = new Swoole\Coroutine\PostgreSQL();
    $db->connect('host=127.0.0.1 port=5432 dbname=db_imi_test user=root password=root');
    $r = $db->query('select 11, 22');
    var_dump($db->fetchAll($r));
});

Before fix result:

array(1) {
  [0]=>
  array(1) {
    ["?column?"]=>
    int(22)
  }
}

After fix result:

array(1) {
  [0]=>
  array(2) {
    ["?column?"]=>
    int(11)
    ["?column?1"]=>
    int(22)
  }
}