예제 #1
0
 public function create($parsed)
 {
     $k = key($parsed);
     switch ($k) {
         case 'UNION':
         case 'UNION ALL':
             throw new UnsupportedFeatureException($k);
             break;
         case 'SELECT':
             $builder = new SelectStatementBuilder();
             $this->created = $builder->build($parsed);
             break;
         case 'INSERT':
             $builder = new InsertStatementBuilder();
             $this->created = $builder->build($parsed);
             break;
         case 'DELETE':
             $builder = new DeleteStatementBuilder();
             $this->created = $builder->build($parsed);
             break;
         case 'UPDATE':
             $builder = new UpdateStatementBuilder();
             $this->created = $builder->build($parsed);
             break;
         case 'RENAME':
             $builder = new RenameStatementBuilder();
             $this->created = $builder->build($parsed);
             break;
         case 'SHOW':
             $builder = new ShowStatementBuilder();
             $this->created = $builder->build($parsed);
             break;
         case 'CREATE':
             $builder = new CreateStatementBuilder();
             $this->created = $builder->build($parsed);
             break;
         case 'BRACKET':
             $builder = new BracketStatementBuilder();
             $this->created = $builder->build($parsed);
             break;
         case 'DROP':
             $builder = new DropStatementBuilder();
             $this->created = $builder->build($parsed);
             break;
         default:
             throw new UnsupportedFeatureException($k);
             break;
     }
     return $this->created;
 }
 public function build(array $parsed)
 {
     $sql = '';
     $select_builder = new SelectStatementBuilder();
     $first = true;
     foreach ($parsed['UNION'] as $clause) {
         if (!$first) {
             $sql .= " UNION ";
         } else {
             $first = false;
         }
         $sql .= $select_builder->build($clause);
     }
     return $sql;
 }
 public function create($parsed)
 {
     $k = key($parsed);
     switch ($k) {
         case "UNION":
         case "UNION ALL":
             throw new UnsupportedFeatureException($k);
             break;
         case "SELECT":
             $builder = new SelectStatementBuilder($parsed);
             $this->created = $builder->build($parsed);
             break;
         case "INSERT":
             $builder = new InsertStatementBuilder($parsed);
             $this->created = $builder->build($parsed);
             break;
         case "DELETE":
             $builder = new DeleteStatementBuilder($parsed);
             $this->created = $builder->build($parsed);
             break;
         case "UPDATE":
             $builder = new UpdateStatementBuilder($parsed);
             $this->created = $builder->build($parsed);
             break;
         case "RENAME":
             $this->created = $this->processRenameTableStatement($parsed);
             break;
         case "SHOW":
             $builder = new ShowStatementBuilder($parsed);
             $this->created = $builder->build($parsed);
             break;
         case "CREATE":
             $builder = new CreateStatementBuilder($parsed);
             $this->created = $builder->build($parsed);
             break;
         default:
             throw new UnsupportedFeatureException($k);
             break;
     }
     return $this->created;
 }
예제 #4
0
 protected function buildSelectStatement($parsed)
 {
     $builder = new SelectStatementBuilder();
     return $builder->build($parsed);
 }