@@ -5,17 +5,17 @@ Cassandra client library for PHP
5
5
<a href =" https://scrutinizer-ci.com/g/duoshuo/php-cassandra/ " ><img src =" https://scrutinizer-ci.com/g/duoshuo/php-cassandra/badges/quality-score.png?b=master " /></a >
6
6
<a href =" https://scrutinizer-ci.com/g/duoshuo/php-cassandra/ " ><img src =" https://scrutinizer-ci.com/g/duoshuo/php-cassandra/badges/build.png?b=master " /></a >
7
7
8
- Cassandra client library for PHP, which support Protocol v3 and asynchronous request
8
+ Cassandra client library for PHP, which support Protocol v3 (Cassandra 2.1) and asynchronous request
9
9
10
10
## Features
11
- * Using Protocol v3
11
+ * Using Protocol v3 (Cassandra 2.1)
12
12
* Support asynchronous and synchronous request
13
13
* Support for logged, unlogged and counter batches
14
14
* The ability to specify the consistency, "serial consistency" and all flags defined in the protocol
15
15
* Support Query preparation and execute
16
16
* Support all data types convertion and binding
17
17
* Support conditional update/insert
18
- * 4 fetch methods (fetchAll, fetchRow, fetchCol, fetchOne)
18
+ * 5 fetch methods (fetchAll, fetchRow, fetchPairs , fetchCol, fetchOne)
19
19
* 800% performance improvement(async mode) than other php cassandra client libraries
20
20
21
21
## Installation
@@ -68,6 +68,9 @@ $rows = $response->fetchAll(); // SplFixedArray
68
68
// Return a SplFixedArray containing a specified index column from the result set.
69
69
$col = $response->fetchCol(); // SplFixedArray
70
70
71
+ // Return a assoc array with key-value pairs, the key is the first column, the value is the second column.
72
+ $col = $response->fetchPairs(); // assoc array
73
+
71
74
// Return the first row of the result set.
72
75
$row = $response->fetchRow(); // ArrayObject
73
76
@@ -120,7 +123,11 @@ $rows = $response->fetchAll();
120
123
$batchRequest = new Cassandra\Request\Batch();
121
124
122
125
// Append a prepared query
123
- $batchRequest->appendQueryId($preparedData['id'], $strictValues);
126
+ $preparedData = $connection->prepare('SELECT * FROM "users" WHERE "id" = :id');
127
+ $values = [
128
+ 'id' => 'c5420d81-499e-4c9c-ac0c-fa6ba3ebc2bc',
129
+ ];
130
+ $batchRequest->appendQueryId($preparedData['id'], Cassandra\Request\Request::strictTypeValues($values, $preparedData['metadata']['columns']));
124
131
125
132
// Append a query string
126
133
$batchRequest->appendQuery(
@@ -180,8 +187,8 @@ All types are supported.
180
187
// CollectionSet
181
188
new Cassandra\Type\CollectionSet([1, 2, 3], Cassandra\Type\Base::INT);
182
189
183
- // Timestamp
184
- new Cassandra\Type\Timestamp(1409830696263 );
190
+ // Timestamp (unit: microseconds)
191
+ new Cassandra\Type\Timestamp(1409830696263000 );
185
192
186
193
// Uuid
187
194
new Cassandra\Type\Uuid('62c36092-82a1-3a00-93d1-46196ee77204');
0 commit comments