本文整理汇总了PHP中DBConnection::query方法的典型用法代码示例。如果您正苦于以下问题:PHP DBConnection::query方法的具体用法?PHP DBConnection::query怎么用?PHP DBConnection::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBConnection
的用法示例。
在下文中一共展示了DBConnection::query方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeSelect
/**
* Executes an SQL SELECT statement
*
* @param rdbms.DBConnection conn
* @param rdbms.Peer peer
* @param rdbms.join.Joinprocessor jp optional
* @param bool buffered default TRUE
* @return rdbms.ResultSet
*/
public function executeSelect(DBConnection $conn, Peer $peer, $jp = null, $buffered = true)
{
$statement = preg_replace('/object\\(([^\\)]+)\\)/i', '$1.' . implode(', $1.', array_keys($peer->types)), $this->statement);
if ($buffered) {
return $conn->query($statement, ...$this->arguments);
} else {
return $conn->open($statement, ...$this->arguments);
}
}
示例2: update
public function update($id)
{
$values = [];
$columns = [];
foreach (static::$columns as $column) {
$values[':' . $column] = $this->{$column};
$columns[] = $column . '=:' . $column;
}
$sql = 'UPDATE' . ' ' . static::$table . ' ' . 'SET' . ' ' . implode(',', $columns) . ' ' . 'WHERE id=:id';
echo $sql;
$res = new DBConnection();
$res->query($sql, $id, $values);
}
示例3: array
$shares = array();
if (!empty($_POST['1'])) {
array_push($shares, $_POST['1']);
}
if (!empty($_POST['2'])) {
array_push($shares, $_POST['2']);
}
if (!empty($_POST['3'])) {
array_push($shares, $_POST['3']);
}
//var_dump($shares);
$reconstructed_secret = reconstruct($shares);
$db = new DBConnection();
$db->connect();
$user = get_user_info();
$secret = $db->query('secret', 'secret', "uid='{$user}'", null, null, null)[0]['secret'];
$db->delete('secret', "uid='{$user}'");
$db->disconnect();
if ($secret == $reconstructed_secret) {
echo "Secrets matching. Access granted.";
} else {
echo "{$secret} != {$reconstructed_secret}. Access denied";
}
} else {
echo "fail";
}
} else {
echo "fail";
}
/* [1,8683146895150534502] [2,17361141234745553751] [3,7143385603424603993]
* Secret 5152555555515253
示例4: DBConnection
<?php
require_once "includes/db.class.inc";
require_once "includes/mailapi.inc";
require_once "includes/session.inc";
if (is_session_active()) {
$db = new DBConnection();
$db->connect();
$user = get_user_info();
$secretshare = $db->query('shares', 'share', "uid='{$user}' AND share LIKE '[2,%'", null, null, null)[0]['share'];
//print_r($secretshare);
$db->delete("shares", "share='{$secretshare}'");
$db->disconnect();
//send secretshare in sms
//sendsms($user, $share)
echo $secretshare;
//echo "fail";
//echo "success";
} else {
echo "fail";
}
示例5: executeSelect
/**
* Executes an SQL SELECT statement
*
* @param rdbms.DBConnection conn
* @param rdbms.Peer peer
* @param rdbms.join.Joinprocessor jp optional
* @param bool buffered default TRUE
* @return rdbms.ResultSet
*/
public function executeSelect(DBConnection $conn, Peer $peer, $jp = NULL, $buffered = TRUE)
{
return $conn->query('%c', $this->getSelectQueryString($conn, $peer, $jp), $buffered);
}