public createTable ( $type ) : string | ||
$type | Cassandra\Type | |
return | string | Table name generated from $type |
public function createTable($type)
{
$query = "CREATE TABLE IF NOT EXISTS %s (key text PRIMARY KEY, value %s)";
$cqlType = $this->typeString($type);
$tableName = "table_" . str_replace(array("-"), "", (string) new Uuid());
$query = sprintf($query, $tableName, $cqlType);
$this->session->execute(new SimpleStatement($query));
return $tableName;
}