Skip to content

Commit

Permalink
minor bugs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maliemin-Mstar committed Sep 28, 2014
1 parent 814dd04 commit 97a88d1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,21 @@ $rows = $response->fetchAll();

```php
$batchRequest = new Cassandra\Request\Batch();
$batchRequest->appendQueryId($preparedData['id'], $strictValues)
->appendQuery(
'INSERT INTO "students" ("id", "name", "age") VALUES (:id, :name, :age)',
[
'id' => new Cassandra\Type\Uuid('c5420d81-499e-4c9c-ac0c-fa6ba3ebc2bc'),
'name' => new Cassandra\Type\Varchar('Mark'),
'age' => 20,
]
);

$response = $connection->syncRequest($batch);

// Append a prepared query
$batchRequest->appendQueryId($preparedData['id'], $strictValues);

// Append a query string
$batchRequest->appendQuery(
'INSERT INTO "students" ("id", "name", "age") VALUES (:id, :name, :age)',
[
'id' => new Cassandra\Type\Uuid('c5420d81-499e-4c9c-ac0c-fa6ba3ebc2bc'),
'name' => new Cassandra\Type\Varchar('Mark'),
'age' => 20,
]
);

$response = $connection->syncRequest($batchRequest);
$rows = $response->fetchAll();
```

Expand Down
2 changes: 1 addition & 1 deletion src/Request/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Batch extends Request{
* @param array $options
*/
public function __construct($type = null, $consistency = null, $options = []) {
$this->_batchType = $type ?: Batch::TYPE_LOGGED;
$this->_batchType = $type === null ? Batch::TYPE_LOGGED : $type;
$this->_consistency = $consistency === null ? Request::CONSISTENCY_QUORUM : $consistency;
$this->_options = $options;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Response/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public function fetchCol($index = 0){
$array = new \SplFixedArray($rowCount);

for($i = 0; $i < $rowCount; ++$i){
foreach($columns as $j => $column){
foreach($this->_metadata['columns'] as $j => $column){
$value = $this->_readBytesAndConvertToType($column['type']);

if ($j == $index)
Expand Down

0 comments on commit 97a88d1

Please sign in to comment.