/** * @param QueryInterface $query * * @return Result|null * @throws Exception */ public function process(QueryInterface $query) { if (!$query instanceof ShowQuery || $query->getObject() !== ShowQuery::EXPRESSION_TABLES) { return null; } $tablet = $this->tablet->getTablet(); $command = new GetSchema($tablet->getAlias()); /* @var $vtCtldResult GetSchemaResult */ $vtCtldResult = $this->client->executeCommand($command); return new Tables($vtCtldResult); }
/** * @param QueryInterface $query * * @return Result|null * @throws Exception */ public function process(QueryInterface $query) { if (!$query instanceof ShowQuery || $query->getObject() !== ShowQuery::EXPRESSION_INDEX) { return null; } $fromExpr = $query->getFromExpression(); if (!$fromExpr) { throw new Exception('From expression missing.'); } $tablet = $this->tablet->getTablet(); $schemaCmd = new GetSchema($tablet->getAlias()); /* @var $result GetSchemaResult */ $result = $this->client->executeCommand($schemaCmd); return new IndexFrom($result, $fromExpr); }
/** * @param QueryInterface $query * * @return Result|null * @throws Exception */ public function process(QueryInterface $query) { if (!$query instanceof ShowQuery || $query->getObject() !== ShowQuery::EXPRESSION_CREATE_TABLE) { return null; } $table = $query->getCreateObjectExpression(ShowQuery::EXPRESSION_CREATE_TABLE); if (!$table) { throw new Exception('Table missing.'); } $tablet = $this->tablet->getTablet(); $schemaCmd = new GetSchema($tablet->getAlias()); /* @var $result GetSchemaResult */ $result = $this->client->executeCommand($schemaCmd); return new CreateTable($result, $table); }