schema() public method

NOTE: the returned Schema instance will not be updated as the actual schema changes, instead an updated instance should be requested by calling Session::schema() again.
public schema ( ) : cassandra\Schema
return cassandra\Schema current schema.
Example #1
0
 /**
  * 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;
 }