public function getColumns($table)
{
$stmt = $this->_pdo->query("PRAGMA table_info({$table})");
$columns = array();
while ($row = $stmt->fetch()) {
$columns[] = $row['name'];
}
return $columns;
}
public function testGetColumns() { $this->pdo->exec('CREATE TABLE test_table ( id INTEGER PRIMARY KEY, name TEXT, email TEXT, age INTEGER )'); $db_util = new SqliteUtil($this->phactory); $columns = $db_util->getColumns('test_table'); $this->assertEquals(['id', 'name', 'email', 'age'], $columns); }