本文整理汇总了PHP中PDOStatement::Execute方法的典型用法代码示例。如果您正苦于以下问题:PHP PDOStatement::Execute方法的具体用法?PHP PDOStatement::Execute怎么用?PHP PDOStatement::Execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PDOStatement
的用法示例。
在下文中一共展示了PDOStatement::Execute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Query_Execute
/**
* The SQL Query Execute combined with Query_Prepare
*
* @version 1
* @author Rick de Man <rick@rickdeman.nl>
*
* @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);
}
示例2: Execute
/**
* 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;
}