/**
* Returns an array of Column objects describing a table
* @param string $tableName
* @param string $keyspaceName
* @return \Phalcon\Db\ColumnInterface[]
* @throws \PhalconCassandra\Db\Exception\Cassandra
*/
public function describeColumns($tableName, $keyspaceName = null)
{
if (empty($keyspaceName)) {
$keyspaceName = $this->_descriptor['keyspace'];
}
$keyspace = $this->_session->schema()->keyspace($keyspaceName);
if (empty($keyspace)) {
throw new CException('Keyspace "' . $keyspaceName . '" not exists');
}
$table = $keyspace->table($tableName);
if (empty($table)) {
throw new CException('Table "' . $tableName . '" not exists');
}
$columns = $table->columns();
$result = [];
$prevCol = null;
foreach ($columns as $col) {
$result[] = $this->_describeColumn($col, $prevCol, $tableName, $keyspaceName);
$prevCol = $col;
}
return $result;
}