Beispiel #1
1
 /**
  * The SQL Query Execute combined with Query_Prepare
  *
  * @version 1
  * @author Rick de Man <*****@*****.**>
  *        
  * @param array $Array
  *        	The values for the SQL to be executed
  * @param bool $Fetchall
  *        	When a single result is found return a multi-dimension Array
  * @param bool $QueryNext
  *        	After executing Free the SQL
  * @return integer|false|array
  */
 public function Query_Execute($Array, $Fetchall = false, $QueryNext = false)
 {
     // The SQL must be free to continue
     if ($this->SQL_Free === true) {
         PDO_Error('SQL isn\'t prepared for a execute command', '', $_SESSION['WMS-Debug']);
     }
     // An array must be provided
     if (!is_array($Array)) {
         $Array = explode(',', $Array);
     }
     try {
         // PDO Execute Statement
         $this->STH->Execute($Array);
         // Load the Backtrace
         $Trace = debug_backtrace();
         $F = $Trace[0]['file'] . ':' . $Trace[0]['line'] . '(' . $Trace[1]['function'] . ')';
         // Store Parameters in the Execution Array
         $this->Log['P'][] = array("A" => implode(',', $Array), "F" => $F);
     } catch (PDOException $e) {
         // Duplicate Error
         $Error = $e->errorInfo[0] . "-" . $e->errorInfo[1];
         if (in_array($Error, array("23000-1062"))) {
             return "SQL Error: {$Error}";
         }
         // Oops, Something went wrong...
         PDO_Error($e->getMessage(), $this->STH->queryString . ' - ( "' . implode('", "', $Array) . ' ")', $_SESSION['WMS-Debug']);
     }
     if ($QueryNext !== false) {
         $this->Query_Next();
     }
     // Return the processed Data
     return $this->Result($Fetchall);
 }
 /**
  * Executes query, measures the total time
  */
 public function Execute($input_parameters = null)
 {
     $Start = microtime(true);
     parent::Execute($input_parameters);
     $End = microtime(true);
     $this->Duration = round($End - $Start, 4);
     $this->Executed = true;
     $this->ExecCount++;
     return $this;
 }