/**
  * Nested composite Cassandra types (list, map, set, tuple, and UDT) to be
  * used by data providers
  */
 public function nestedCassandraTypes()
 {
     $compositeCassandraTypes = $this->compositeCassandraTypes();
     foreach ($compositeCassandraTypes as $nestedType) {
         $type = Type::collection($nestedType[0]);
         $nestedCassandraTypes[] = array($type, array($type->create($nestedType[1][0])));
     }
     foreach ($compositeCassandraTypes as $nestedType) {
         $type = Type::set($nestedType[0]);
         $nestedCassandraTypes[] = array($type, array($type->create($nestedType[1][0])));
     }
     foreach ($compositeCassandraTypes as $nestedType) {
         $type = Type::map($nestedType[0], $nestedType[0]);
         $nestedCassandraTypes[] = array($type, array($type->create($nestedType[1][0], $nestedType[1][1])));
     }
     foreach ($compositeCassandraTypes as $nestedType) {
         $type = Type::tuple($nestedType[0], $nestedType[0]);
         $nestedCassandraTypes[] = array($type, array($type->create($nestedType[1][0], $nestedType[1][1])));
     }
     foreach ($compositeCassandraTypes as $nestedType) {
         $type = Type::userType("a", $nestedType[0], "b", $nestedType[0]);
         $type = $type->withName(self::userTypeString($type));
         $nestedCassandraTypes[] = array($type, array($type->create("a", $nestedType[1][0], "b", $nestedType[1][1])));
     }
     return $nestedCassandraTypes;
 }
Exemplo n.º 2
0
 public function compositeTypes()
 {
     $map_type = Type::map(Type::varchar(), Type::varchar());
     $set_type = Type::set(Type::varchar());
     $list_type = Type::collection(Type::varchar());
     $tuple_type = Type::tuple(Type::varchar(), Type::int());
     return array(array($map_type, $map_type->create("a", "1", "b", "2")), array($set_type, $set_type->create("a", "b", "c")), array($list_type, $list_type->create("a", "b", "c")), array($tuple_type, $tuple_type->create("a", 42)));
 }
Exemplo n.º 3
0
 public function compositeTypes()
 {
     return array(array(Type::map(Type::varchar(), Type::varchar())), array(Type::set(Type::varchar())), array(Type::collection(Type::varchar())));
 }
Exemplo n.º 4
0
 /**
  * Bind statement with an null map
  */
 public function testEmpty()
 {
     $mapType = Type::map(Type::int(), Type::int());
     $this->createTableInsertAndVerifyValueByIndex($mapType, null);
     $this->createTableInsertAndVerifyValueByName($mapType, null);
 }
Exemplo n.º 5
0
 /**
  * Return the variable type name
  * @return string The value of the type (@see Type::map)
  */
 public function getTypeName()
 {
     return Type::map($this->type);
 }
 /**
  * Returns the base type name for the provided column.
  * This represent the schema type a more complex class is
  * based upon.
  *
  * @param string $column The column name to get the base type from
  * @return string The base type name
  */
 public function baseColumnType($column)
 {
     if (isset($this->_columns[$column]['baseType'])) {
         return $this->_columns[$column]['baseType'];
     }
     $type = $this->columnType($column);
     if ($type === null) {
         return null;
     }
     if (Type::map($type)) {
         $type = Type::build($type)->getBaseType();
     }
     return $this->_columns[$column]['baseType'] = $type;
 }