Skip to content

Commit fd5a945

Browse files
committed
implement README.md
1 parent 97a88d1 commit fd5a945

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

README.md

+13-6
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ Cassandra client library for PHP
55
<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>
66
<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>
77

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
99

1010
## Features
11-
* Using Protocol v3
11+
* Using Protocol v3 (Cassandra 2.1)
1212
* Support asynchronous and synchronous request
1313
* Support for logged, unlogged and counter batches
1414
* The ability to specify the consistency, "serial consistency" and all flags defined in the protocol
1515
* Support Query preparation and execute
1616
* Support all data types convertion and binding
1717
* Support conditional update/insert
18-
* 4 fetch methods (fetchAll, fetchRow, fetchCol, fetchOne)
18+
* 5 fetch methods (fetchAll, fetchRow, fetchPairs, fetchCol, fetchOne)
1919
* 800% performance improvement(async mode) than other php cassandra client libraries
2020

2121
## Installation
@@ -68,6 +68,9 @@ $rows = $response->fetchAll(); // SplFixedArray
6868
// Return a SplFixedArray containing a specified index column from the result set.
6969
$col = $response->fetchCol(); // SplFixedArray
7070

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+
7174
// Return the first row of the result set.
7275
$row = $response->fetchRow(); // ArrayObject
7376

@@ -120,7 +123,11 @@ $rows = $response->fetchAll();
120123
$batchRequest = new Cassandra\Request\Batch();
121124

122125
// 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']));
124131

125132
// Append a query string
126133
$batchRequest->appendQuery(
@@ -180,8 +187,8 @@ All types are supported.
180187
// CollectionSet
181188
new Cassandra\Type\CollectionSet([1, 2, 3], Cassandra\Type\Base::INT);
182189

183-
// Timestamp
184-
new Cassandra\Type\Timestamp(1409830696263);
190+
// Timestamp (unit: microseconds)
191+
new Cassandra\Type\Timestamp(1409830696263000);
185192

186193
// Uuid
187194
new Cassandra\Type\Uuid('62c36092-82a1-3a00-93d1-46196ee77204');

0 commit comments

Comments
 (0)