コード例 #1
0
ファイル: SchemaController.php プロジェクト: rezonant/datasha
 /**
  * @REST\Post("/connections/{id}/schema/dbs/{db}/tables")
  */
 public function getSchemaTables($id, $db, Request $request)
 {
     $details = json_decode($request->getContent());
     $key = $request->request->get('key');
     $connection = $this->connections->getConnection($id);
     if (!$connection) {
         return new Response('{"message":"No such connection"}', 404);
     }
     if (!$connection->unlock($key)) {
         return new Response('{"message":"Invalid key"}', 400);
     }
     return $this->schema->getTablesWithDetails($connection, $db);
 }
コード例 #2
0
ファイル: QueryController.php プロジェクト: rezonant/datasha
 /**
  * @REST\Post("/connections/{connectionID}/dbs/{db}/query/analyze")
  */
 public function analyzeQuery($connectionID, $db, Request $request)
 {
     $rq = json_decode($request->getContent());
     $query = $rq->query;
     $key = $rq->key;
     $cnx = $this->connections->getConnection($connectionID);
     if (!$cnx) {
         return new Response('{"message":"Not Found"}', 404);
     }
     if (!$cnx->unlock($key)) {
         return new Response('{"message":"Invalid access key"}', 400);
     }
     return $this->queries->analyzeQuery($cnx, $db, $query);
 }