コード例 #1
0
ファイル: MySQLClass.php プロジェクト: THM068/orangehrm
 /**
  * This method will execute an SQL statement using mysql_query() function
  * @param String $sql SQL statement to be executed
  * @return ResultResource If the statement executed success, boolean false in an error
  */
 public function sqlQuery($sql)
 {
     if (isset($this->conn) && $sql != '') {
         $this->result = mysql_query($sql);
         if ($this->result) {
             return $this->result;
         }
         /* 
          * Return false if duplicate key is entered
          * TODO: Throw an exception here, and chanage code to catch it on model level
          */
         if (mysql_errno() == 1062) {
             return false;
         }
         $exception_handler = new ExceptionHandler();
         $exception_handler->dbexInvalidSQL($sql);
         return false;
     } else {
         $exception_handler = new ExceptionHandler();
         $exception_handler->dbexNoQueryFound($sql);
         return false;
     }
 }
コード例 #2
0
ファイル: MySQLClass.php プロジェクト: noikiy/owaspbwa
 function sqlQuery($sql)
 {
     if (isset($this->conn) && $sql != '') {
         $this->result = mysql_query($sql);
         if ($this->result) {
             return $this->result;
         }
         if (mysql_errno() == 1062) {
             return false;
         }
         $exception_handler = new ExceptionHandler();
         $exception_handler->dbexInvalidSQL($sql);
         return false;
     } else {
         $exception_handler = new ExceptionHandler();
         $exception_handler->dbexNoQueryFound($sql);
         return false;
     }
 }