예제 #1
0
파일: MySql.php 프로젝트: katropine/kmapper
 /**
  *
  * @param type $sql = "INSERT INTO table SET field1 = '?', field2 = '?';"
  * @param array $params = ('Val1', 1, 6)
  * @param array $options - [resource 'dbo'] - 0ptional 
  * @return MySqlQuery result object
  */
 public static function execute($sql = '', array $params = array(), array $options = array())
 {
     if ($sql == '') {
         throw new \Exception("Not a valid SQL.");
     }
     //just in case
     $options['connection'] = self::extractDbo($options);
     $MySql = new MySqlQuery($sql, $params, $options);
     if (!$MySql instanceof MySqlQuery) {
         throw new \Exception("Faild to create MySqlQuery object.");
     }
     return $MySql->getResult();
 }