Пример #1
0
 public function execute(Context $ctx, $query, array $bind_vars, $tablet_type)
 {
     $request = new Proto\Vtgate\ExecuteRequest();
     $request->setQuery(ProtoUtils::BoundQuery($query, $bind_vars));
     $request->setTabletType($tablet_type);
     if ($ctx->getCallerId()) {
         $request->setCallerId($ctx->getCallerId());
     }
     $response = $this->client->execute($ctx, $request);
     ProtoUtils::checkError($response);
     return new Cursor($response->getResult());
 }
Пример #2
0
 public function execute(Context $ctx, $query, 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\ExecuteRequest();
     $request->setSession($this->session);
     $request->setQuery(ProtoUtils::BoundQuery($query, $bind_vars));
     $request->setTabletType($tablet_type);
     $request->setKeyspace($this->keyspace);
     if ($ctx->getCallerId()) {
         $request->setCallerId($ctx->getCallerId());
     }
     $response = $this->client->execute($ctx, $request);
     $this->session = $response->getSession();
     ProtoUtils::checkError($response);
     return new Cursor($response->getResult());
 }