From 332442996c8e736938369cb2f8e21637c9b4b3ac Mon Sep 17 00:00:00 2001 From: shen2 Date: Tue, 16 Sep 2014 00:08:38 +0800 Subject: [PATCH] add Connection::flush(); --- src/Connection.php | 9 +++++++++ src/Response/Result.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Connection.php b/src/Connection.php index 50b4a89..249939e 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -186,6 +186,15 @@ protected function _getResponse() { return $response; } + /** + * Wait until all statements received response. + */ + public function flush(){ + while(!empty($this->_statements)){ + $this->_getResponse(); + } + } + /** * @return Connection\Node */ diff --git a/src/Response/Result.php b/src/Response/Result.php index 1266153..4815b9c 100644 --- a/src/Response/Result.php +++ b/src/Response/Result.php @@ -42,7 +42,7 @@ protected function _readBytesAndConvertToType($type){ $length = unpack('N', substr($this->data, $this->offset, 4))[1]; $this->offset += 4; - if ($length === 4294967295) + if ($length === 0xffffffff) return null; // do not use $this->read() for performance