protected function defineQuery()
 {
     $preFormatedRawQuery = trim(strtolower($this->rawQuery));
     if (strpos($preFormatedRawQuery, 'create table') !== false) {
         $this->query = QueryFactory::instantiate('create');
         return true;
     }
 }
Esempio n. 2
0
 protected function defineQuery($rawQuery)
 {
     $preFormatedRawQuery = trim(strtolower($rawQuery));
     if (strpos($preFormatedRawQuery, 'create table') !== false) {
         $query = QueryFactory::instantiate('create', $rawQuery);
         $this->getQueries()->add($query->getTable(), $query);
     }
 }
 public function testInstantiateSShouldReturnInvalidQueryExceptionWhenInvalidParamPassed()
 {
     $query = "UPDATE PREFIX_roles SET `Description` = 'root'";
     try {
         $class = QueryFactory::instantiate('update', $query);
     } catch (\Highideas\SqlToMigration\Exceptions\InvalidQueryException $expected) {
         $this->assertEquals('Type of Query Not Found.', $expected->getMessage());
         $this->assertEquals('update', $expected->getName());
         return;
     }
     $this->fail('An expected exception has not been raised.');
 }