public function executeKeyRanges(Context $ctx, $query, $keyspace, array $key_ranges, array $bind_vars, $tablet_type = Proto\Topodata\TabletType::MASTER) { if (!$this->inTransaction()) { throw new \Vitess\Exception('execute called while not in transaction.'); } $request = new Proto\Vtgate\ExecuteKeyRangesRequest(); $request->setSession($this->session); $request->setQuery(ProtoUtils::BoundQuery($query, $bind_vars)); $request->setTabletType($tablet_type); $request->setKeyspace($keyspace); ProtoUtils::addKeyRanges($request, $key_ranges); if ($ctx->getCallerId()) { $request->setCallerId($ctx->getCallerId()); } $response = $this->client->executeKeyRanges($ctx, $request); $this->session = $response->getSession(); ProtoUtils::checkError($response); return new Cursor($response->getResult()); }
public function streamExecuteKeyRanges(Context $ctx, $query, $keyspace, array $key_ranges, array $bind_vars, $tablet_type) { $request = new Proto\Vtgate\StreamExecuteKeyRangesRequest(); $request->setQuery(ProtoUtils::BoundQuery($query, $bind_vars)); $request->setKeyspace($keyspace); ProtoUtils::addKeyRanges($request, $key_ranges); $request->setTabletType($tablet_type); if ($ctx->getCallerId()) { $request->setCallerId($ctx->getCallerId()); } $call = $this->client->streamExecuteKeyRanges($ctx, $request); return new StreamCursor($call); }