本文整理汇总了PHP中ADODB_mysqli::Prepare方法的典型用法代码示例。如果您正苦于以下问题:PHP ADODB_mysqli::Prepare方法的具体用法?PHP ADODB_mysqli::Prepare怎么用?PHP ADODB_mysqli::Prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ADODB_mysqli
的用法示例。
在下文中一共展示了ADODB_mysqli::Prepare方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareStatement
/**
* Prepares statement and params
*/
private function prepareStatement()
{
$this->stmt = $this->db->Prepare("\n SELECT\n `s`.`server_id` AS `server_id`,\n `s`.`status` AS `status`\n FROM `servers` AS `s`\n LEFT JOIN `server_properties` AS `attempt`\n ON `attempt`.`server_id` = `s`.`server_id` AND `attempt`.`name` = ?\n LEFT JOIN `server_properties` AS `last_try`\n ON `last_try`.`server_id` = `s`.`server_id` AND `last_try`.`name` = ?\n LEFT JOIN `temporary_server_status_check_config` AS `config`\n ON IF(`attempt`.`value` > ?, ?, `attempt`.`value`) = `config`.`attempt`\n JOIN `clients` AS `c`\n ON `c`.`id` = `client_id`\n JOIN `client_environments` AS `e`\n ON `e`.`id` = `env_id`\n WHERE\n `s`.`status` IN (?, ?) AND `s`.`dtadded` < NOW() - INTERVAL 1 DAY OR (\n `s`.`status` = ? AND\n `c`.`status` = ? AND\n `e`.`status` = ? AND (\n `attempt`.`value` IS NULL OR\n `last_try`.`value` < NOW() - INTERVAL `config`.`interval` DAY_SECOND\n )\n )\n ");
$maxAttempts = max(array_keys($this->attemptConfig));
$this->params = [SERVER_PROPERTIES::LAUNCH_ATTEMPT, SERVER_PROPERTIES::LAUNCH_LAST_TRY, $maxAttempts, $maxAttempts, SERVER_STATUS::IMPORTING, SERVER_STATUS::TEMPORARY, SERVER_STATUS::PENDING_LAUNCH, Scalr_Account::STATUS_ACTIVE, Scalr_Environment::STATUS_ACTIVE];
}
示例2: hasTableCompatibleIndex
/**
* {@inheritdoc}
* @see UpdateInterface::hasTableCompatibleIndex()
*/
public function hasTableCompatibleIndex($table, array $columns, $unique = false)
{
$compatible = null;
//Columns may be provided without indexes like ['col1', 'col2', ..., 'colN'].
//In this case index should mutually start from 1 instead of specified 0.
$dx = isset($columns[0]) ? 1 : 0;
$stmt = $this->db->Prepare("SHOW INDEX FROM `{$table}` WHERE `Column_name` = ? AND `Seq_in_index` = ? AND `Non_unique` = ?");
foreach ($columns as $idx => $column) {
$entries = $this->db->Execute($stmt, [$column, $idx + $dx, $unique ? 0 : 1]);
$indexes = [];
foreach ($entries->GetAll() as $entry) {
$indexes[] = $entry['Key_name'];
}
$compatible = empty($compatible) ? $indexes : array_intersect($compatible, $indexes);
if (empty($compatible)) {
return false;
}
}
return empty($compatible) ? false : $compatible;
}