@@ -40,6 +40,7 @@ public function scalarCassandraTypes() {
4040 new Duration (-1 , 0 , -(2 ** 31 )),
4141 new Duration ((2 ** 31 ) - 1 , 1 , 0 ),
4242 new Duration (-(2 ** 31 ), -1 , 0 ))),
43+ array (Type::int (), array (1 , 2 , 99 )),
4344 array (Type::float (), array (new Float (1.0 ), new Float (2.2 ), new Float (2.2 ))),
4445 array (Type::inet (), array (new Inet ("127.0.0.1 " ), new Inet ("127.0.0.2 " ), new Inet ("127.0.0.3 " ))),
4546 array (Type::smallint (), array (Smallint::min (), Smallint::max (), new Smallint (0 ), new Smallint (74 ))),
@@ -56,6 +57,40 @@ public function scalarCassandraTypes() {
5657 );
5758 }
5859
60+ /**
61+ * Global constant scalar Cassandra types to be used by data providers
62+ */
63+ public function constantScalarCassandraTypes () {
64+ $ constants = array (
65+ \Cassandra::TYPE_TEXT ,
66+ \Cassandra::TYPE_ASCII ,
67+ \Cassandra::TYPE_VARCHAR ,
68+ \Cassandra::TYPE_BIGINT ,
69+ \Cassandra::TYPE_SMALLINT ,
70+ \Cassandra::TYPE_TINYINT ,
71+ \Cassandra::TYPE_BLOB ,
72+ \Cassandra::TYPE_BOOLEAN ,
73+ \Cassandra::TYPE_DECIMAL ,
74+ \Cassandra::TYPE_DOUBLE ,
75+ \Cassandra::TYPE_FLOAT ,
76+ \Cassandra::TYPE_INT ,
77+ \Cassandra::TYPE_TIMESTAMP ,
78+ \Cassandra::TYPE_UUID ,
79+ \Cassandra::TYPE_VARINT ,
80+ \Cassandra::TYPE_TIMEUUID ,
81+ \Cassandra::TYPE_INET
82+ );
83+ $ scalarCassandraTypes = $ this ->scalarCassandraTypes ();
84+
85+ return array_map (function ($ type ) use ($ scalarCassandraTypes ) {
86+ $ match = array_filter ($ scalarCassandraTypes , function ($ item ) use ($ type ) {
87+ return (string )$ item [0 ] === $ type ;
88+ });
89+ assert (isset ($ match ) && count ($ match ) > 0 );
90+ return array ($ type , current ($ match )[1 ]);
91+ }, $ constants );
92+ }
93+
5994 /**
6095 * Create a table using $type for the value's type and insert $value using
6196 * positional parameters.
0 commit comments