Example #1
0
 /**
  * @return Select
  */
 public static function make($sSql, $factors = null)
 {
     $factors = func_get_args();
     $sSql = array_shift($factors);
     if (!($arrRawSqls = self::parseSql($sSql)) or empty($arrRawSqls[0])) {
         return;
     }
     if (isset($arrRawSqls[0]['command'])) {
         switch ($arrRawSqls[0]['command']) {
             case 'SELECT':
                 $aSql = new Select();
             case 'INSERT':
                 $aSql = new Insert();
             case 'UPDATE':
                 $aSql = new Update();
             case 'DELETE':
                 $aSql = new Delete();
                 break;
             default:
                 $aSql = new SQL();
                 break;
         }
     } else {
         $aSql = new SQL();
     }
     $aSql->setRawSql($arrRawSqls[0]);
     if ($factors) {
         $aSql->addFactors($factors);
     }
     return $aSql;
 }