varchar() закрытый статический публичный Метод

Get representation of cassandra varchar type
final static public varchar ( ) : Cassandra\Type
Результат Cassandra\Type varchar type
Пример #1
0
 public function testSupportsKeyBasedAccess()
 {
     $map = Type::map(Type::varint(), Type::varchar())->create();
     $this->assertEquals(0, count($map));
     $map->set(new Varint('123'), 'value');
     $this->assertEquals(1, count($map));
     $this->assertTrue($map->has(new Varint('123')));
     $this->assertEquals('value', $map->get(new Varint('123')));
     $map->set(new Varint('123'), 'another value');
     $this->assertEquals(1, count($map));
     $this->assertEquals('another value', $map->get(new Varint('123')));
 }
Пример #2
0
 public function scalarTypes()
 {
     return array(array(function () {
         return Type::ascii();
     }), array(function () {
         return Type::bigint();
     }), array(function () {
         return Type::blob();
     }), array(function () {
         return Type::boolean();
     }), array(function () {
         return Type::counter();
     }), array(function () {
         return Type::decimal();
     }), array(function () {
         return Type::double();
     }), array(function () {
         return Type::float();
     }), array(function () {
         return Type::inet();
     }), array(function () {
         return Type::int();
     }), array(function () {
         return Type::text();
     }), array(function () {
         return Type::timestamp();
     }), array(function () {
         return Type::timeuuid();
     }), array(function () {
         return Type::uuid();
     }), array(function () {
         return Type::varchar();
     }), array(function () {
         return Type::varint();
     }));
 }
Пример #3
0
 public function notEqualTypes()
 {
     return array(array(Type::collection(Type::varchar()), Type::collection(Type::int())), array(Type::collection(Type::collection(Type::varchar())), Type::collection(Type::collection(Type::int()))), array(Type::collection(Type::collection(Type::int())), Type::collection(Type::set(Type::int()))));
 }
Пример #4
0
 /**
  * Invalid datatypes for tuples.
  *
  * This test will ensure that an exception will occur when an invalid
  * datatype is used inside a tuple; issues from the server.
  *
  * @test
  * @ticket PHP-58
  * @expectedException \Cassandra\Exception\InvalidQueryException
  */
 public function testInvalidType()
 {
     $validType = Type::tuple(Type::int());
     $invalidType = Type::tuple(Type::varchar());
     $tableName = $this->createTable($validType);
     $options = new ExecutionOptions(array('arguments' => array("key", $invalidType->create("value"))));
     $this->insertValue($tableName, $options);
 }
Пример #5
0
 public function notEqualTypes()
 {
     return array(array(Type::userType('a', Type::int()), Type::userType('a', Type::varchar())), array(Type::userType('a', Type::int(), 'b', Type::varchar()), Type::userType('a', Type::int(), 'b', Type::bigint())), array(Type::userType('a', Type::int(), 'b', Type::varchar(), 'c', Type::varint()), Type::userType('a', Type::int(), 'b', Type::varchar(), 'c', Type::bigint())), array(Type::userType('a', Type::collection(Type::int()), 'b', Type::set(Type::varchar())), Type::userType('a', Type::collection(Type::int()), 'b', Type::set(Type::int()))), array(Type::userType('a', Type::int()), Type::userType('b', Type::int())), array(Type::userType('a', Type::int(), 'c', Type::varchar()), Type::userType('b', Type::int(), 'c', Type::varchar())));
 }
Пример #6
0
 /**
  * @expectedException        InvalidArgumentException
  * @expectedExceptionMessage argument must be a string, '1' given
  */
 public function testPreventsCreatingSetWithUnsupportedTypes()
 {
     Type::set(Type::varchar())->create(1);
 }
Пример #7
0
 /**
  * @expectedException        InvalidArgumentException
  * @expectedExceptionMessage keyType must be Cassandra\Type::varchar(),
  *                           Cassandra\Type::text(), Cassandra\Type::blob(),
  *                           Cassandra\Type::ascii(), Cassandra\Type::bigint(),
  *                           Cassandra\Type::counter(), Cassandra\Type::int(),
  *                           Cassandra\Type::varint(), Cassandra\Type::boolean(),
  *                           Cassandra\Type::decimal(), Cassandra\Type::double(),
  *                           Cassandra\Type::float(), Cassandra\Type::inet(),
  *                           Cassandra\Type::timestamp(), Cassandra\Type::uuid()
  *                           or Cassandra\Type::timeuuid(), an instance of
  *                           Cassandra\Type\UnsupportedType given
  */
 public function testPreventsDefiningMapsWithUnsupportedTypes()
 {
     Type::map(new UnsupportedType(), Type::varchar());
 }
Пример #8
0
 public function notEqualTypes()
 {
     $setType = Type::set(Type::int());
     return array(array(Type::map(Type::int(), Type::int())->create(), Type::map(Type::int(), Type::varchar())->create()), array(Type::map(Type::int(), Type::varchar())->create(1, 'a', 2, 'b', 3, 'c'), Type::map(Type::int(), Type::varchar())->create(1, 'a')), array(Type::map($setType, Type::varchar())->create($setType->create(4, 5, 6), 'a', $setType->create(7, 8, 9), 'b'), Type::map($setType, Type::varchar())->create($setType->create(1, 2, 3), 'a', $setType->create(4, 5, 6), 'b')));
 }
Пример #9
0
 /**
  * @expectedException        InvalidArgumentException
  * @expectedExceptionMessage argument must be a string, '1' given
  */
 public function testPreventsCreatingCollectionWithUnsupportedTypes()
 {
     Type::collection(Type::varchar())->create(1);
 }
Пример #10
0
 public function testAllowCreatingTypes()
 {
     $this->assertEquals("some string", Type::varchar()->create("some string"));
 }