本文整理匯總了PHP中type::query方法的典型用法代碼示例。如果您正苦於以下問題:PHP type::query方法的具體用法?PHP type::query怎麽用?PHP type::query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類type
的用法示例。
在下文中一共展示了type::query方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: spatial_index_builder_get_location_list
/**
* Build a temporary table with the list of new and changed locations we will process, so that we have
* consistency if changes are happening concurrently.
* @param type $db
*/
function spatial_index_builder_get_location_list($last_run_date, $db)
{
$filter = spatial_index_builder_get_type_filter();
list($join, $where) = $filter;
$query = "select l.id, now() as timepoint into temporary loclist \nfrom locations l\n{$join}\nwhere l.deleted=false \nand l.updated_on>'{$last_run_date}'\n{$where}";
$db->query($query);
$r = $db->query('select count(*) as count from loclist')->result_array(false);
$message = "Building spatial index for " . $r[0]['count'] . " locations(s)";
echo "{$message}<br/>";
Kohana::log('debug', $message);
return $r[0]['count'];
}
示例2: _initStatement
protected function _initStatement()
{
// \MUtil_Echo::track($this->_select->__toString());
$this->_i = 0;
$this->_statement = $this->_select->query();
$this->_row = $this->_statement->fetch();
}
示例3: query
/**
*
* @param type $conn
* @param type $query
* @return type
*/
public static function query($table, $conn, $query)
{
$sql = "INSERT INTO {$table} VALUES ({$query})";
if ($conn->query($sql) === FALSE) {
return "Error: " . $sql . "<br>" . $conn->error;
}
}
示例4: showTables
/**
*
* @param type $db
* @return type
*/
public static function showTables($db)
{
$sql = $db->query('SHOW FULL TABLES ');
while ($data = $sql->fetch(PDO::FETCH_ASSOC)) {
$tables[] = $data;
}
return $tables;
}
示例5: get_config
/**
*
* Gets all configuration information
* @param type $db -> DB connection
*/
public static function get_config($db)
{
$qry = 'SELECT * FROM codo_config';
$res = $db->query($qry);
$conf = $res->fetchAll();
$info = array();
foreach ($conf as $c) {
$info[$c['option_name']] = self::valid_JSON($c['option_value']);
}
self::$options = $info;
}
示例6: execute
/**
* @brief 事務隊列bootstrap
* @return type 若返回值為false,說明事務開啟失敗
*/
public function execute($callback = null)
{
if (null !== $callback) {
$this->setCallback($callback);
}
if (!empty(self::$_TransGc)) {
//事務對象回收 更快的內存回收和資源釋放
foreach (self::$_TransGc as $key => $val) {
unset(self::$_TransGc[$key]);
}
}
if (count($this->_arrQueueKey) <= 1) {
throw new Exception("Transaction require more then two write style sql");
}
$sql = 'set autocommit=0';
return $this->_dbObj->query($sql, array($this, 'transCallback'), false);
}
示例7: averigua_campos_tabla
/**
* Esta función devuelve los campos de una tabla separados por '|'
* Se supone que ya estas conectado a la BD
* @param type $db | conexión a una BD
* @param type $tabla | tabla a la que se desea consultar
* @return type | cadena con la lista de campos
*/
function averigua_campos_tabla($db, $tabla)
{
try {
$consulta = "describe " . $tabla . ";";
$result = $db->query($consulta);
$cad = "";
foreach ($result as $i) {
// print $i['Field'];
$cad = $cad . $i['Field'] . '|';
}
return $cad;
$db = null;
} catch (Exception $e) {
echo 'Excepción capturada: ', $e->getMessage(), "\n";
$db = null;
return $e->getMessage();
}
}
示例8: select_limit
/**
* Ejecuta una sentencia SQL de tipo select, pero con paginación,
* y devuelve un array con los resultados,
* o false en caso de fallo.
* Limit es el número de elementos que quieres que devuelve.
* Offset es el número de resultado desde el que quieres que empiece.
* @param type $sql
* @param type $limit
* @param type $offset
* @return type
*/
public function select_limit($sql, $limit, $offset)
{
$resultado = FALSE;
if (self::$link) {
$sql .= ' LIMIT ' . $limit . ' OFFSET ' . $offset . ';';
self::$history[] = $sql;
$filas = self::$link->query($sql);
if ($filas) {
$resultado = array();
while ($row = $filas->fetch_array(MYSQLI_ASSOC)) {
$resultado[] = $row;
}
$filas->free();
} else {
self::$errors[] = self::$link->error;
}
self::$t_selects++;
}
return $resultado;
}
示例9: add_record_relation_to_templ
/** Add relation between zone record and template
*
* @param type $db DB link
* @param type $domain_id Domain id
* @param type $record_id Record id
* @param type $zone_templ_id Zone template id
*/
function add_record_relation_to_templ($db, $domain_id, $record_id, $zone_templ_id)
{
$query = "INSERT INTO records_zone_templ (domain_id, record_id, zone_templ_id) VALUES (" . $db->quote($domain_id, 'integer') . "," . $db->quote($record_id, 'integer') . "," . $db->quote($zone_templ_id, 'integer') . ")";
$db->query($query);
}
示例10: updateCount
/**
* 更新統計記錄
* @param type $cus_id
* @param type $platform
* @param type $counter
* @param type $db
* @return type
*/
function updateCount($cus_id, $platform, $counter, $db)
{
$today = date("Y-m-d");
$lastday = date('Y-m-d', strtotime("-1 day"));
if ($platform == "pc") {
if ($counter['record_date'] == $today) {
//最後訪問當天訪問
$res = $db->query("update up_statis set count_all=count_all+1, count_today=count_today+1 where cus_id={$cus_id}");
} elseif ($counter['record_date'] == $lastday) {
//最後訪問是昨天
$res = $db->query("update up_statis set count_all=count_all+1, count_lastday={$counter['count_today']}, count_today=1, record_date='{$today}' where cus_id={$cus_id}");
} else {
//最後訪問是很久以前
$res = $db->query("update up_statis set count_all=count_all+1, count_lastday=0, count_today=1, record_date='{$today}' where cus_id={$cus_id}");
}
} elseif ($platform == "mobile") {
if ($counter['record_date'] == $today) {
//最後訪問當天訪問
$res = $db->query("update up_statis set count_all=count_all+1, count_today=count_today+1, mobile_count=mobile_count+1 where cus_id={$cus_id}");
} elseif ($counter['record_date'] == $lastday) {
//最後訪問是昨天
$res = $db->query("update up_statis set count_all=count_all+1, count_lastday={$counter['count_today']}, count_today=1, mobile_count=mobile_count+1, record_date='{$today}' where cus_id={$cus_id}");
} else {
//最後訪問是很久以前
$res = $db->query("update up_statis set count_all=count_all+1, count_lastday=0, count_today=1, mobile_count=mobile_count+1, record_date='{$today}' where cus_id={$cus_id}");
}
}
return $res;
}
示例11: updateMdpVisiteur
/**
* Permet de réatribuer un mot de passe composé de 5 caractères (lettres minuscules et chiffres) généré aléatoirement
* pour chaque visiteur
* @param type $pdo
*/
function updateMdpVisiteur($pdo)
{
$req = "select * from Visiteur";
$res = $pdo->query($req);
$lesLignes = $res->fetchAll();
$lettres = "azertyuiopqsdfghjkmwxcvbn123456789";
foreach ($lesLignes as $unVisiteur) {
$mdp = "";
$id = $unVisiteur['id'];
for ($i = 1; $i <= 5; $i++) {
$uneLettrehasard = substr($lettres, rand(33, 1), 1);
$mdp = $mdp . $uneLettrehasard;
}
$req = "update Visiteur set mdp ='{$mdp}' where Visiteur.id ='{$id}' ";
$pdo->exec($req);
}
}
示例12: data_cleaner_update_occurrence_metadata
/**
* Update the metadata associated with each occurrence so we know the rules have been run.
* @param type $db Kohana database instance.
*/
function data_cleaner_update_occurrence_metadata($db, $endtime)
{
// Note we use the information from the point when we started the process, in case
// any changes have happened in the meanwhile which might otherwise be missed.
$query = "update occurrences o\nset last_verification_check_date='{$endtime}'\nfrom occdelta\nwhere occdelta.id=o.id and occdelta.record_status not in ('I','V','R','D')";
$db->query($query);
}
示例13: catch
/**
* Checks if the rich snippet property element whose name is specified
* by $prop_name exists within the wrapper article element.
*
* @author Leo Fajardo (@leorw)
* @since 2.5.2
*
* @param type $xpath
* @param type $article_wrapper_element
* @param type $property_name
* @return boolean
*/
function rich_snippet_property_exists($xpath, $article_wrapper_element, $property_name)
{
RWLogger::LogEnterence('rich_snippet_property_exists');
try {
// Find the ancestors with "itemscope" and "itemtype" attributes of the elements in the specified wrapper element
// whose itemprop attribute's value is specified by $property_name.
$ancestors = $xpath->query(".//*[@itemprop = '{$property_name}']/ancestor::*[@itemscope and @itemtype]", $article_wrapper_element);
if ($ancestors->length) {
$ancestor = $ancestors->item(0);
if ('http://schema.org/Article' === $ancestor->getAttribute('itemtype')) {
return true;
}
}
} catch (Exception $e) {
if (RWLogger::IsOn()) {
RWLogger::Log('rich_snippet_property_exists', 'Error: ' . $e->getMessage());
}
}
RWLogger::LogDeparture('rich_snippet_property_exists');
return false;
}
示例14: execute
/**
* @brief 協程執行
* @param type $callback
*/
public function execute($callback)
{
$this->_mysqli->query($this->_sql, $callback);
}
示例15: data_cleaner_update_occurrence_metadata
/**
* Update the metadata associated with each occurrence so we know the rules have been run.
* @param type $db Kohana database instance.
*/
function data_cleaner_update_occurrence_metadata($db)
{
// Note we use the information from the point when we started the process, in case
// any changes have happened in the meanwhile which might otherwise be missed.
$query = 'update occurrences o
set last_verification_check_date=occlist.timepoint,
last_verification_check_taxa_taxon_list_id=occlist.taxa_taxon_list_id
from occlist
where occlist.id=o.id';
$db->query($query);
}