本文整理汇总了PHP中DBConnection::id方法的典型用法代码示例。如果您正苦于以下问题:PHP DBConnection::id方法的具体用法?PHP DBConnection::id怎么用?PHP DBConnection::id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBConnection
的用法示例。
在下文中一共展示了DBConnection::id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: escape
/**
* Return an escaped string for use in a query.
*
* @param string $string The string to escape.
* @param boolean $escapeall Set true to also escape _ and % for LIKE queries.
* @return string
*/
public static function escape($string, $escapeall = false)
{
if (is_null(self::$dbconn)) {
self::$dbconn = new DBConnection();
}
if ($escapeall) {
return addcslashes(self::$dbconn->id()->real_escape_string($string), '%_');
} else {
return self::$dbconn->id()->real_escape_string($string);
}
}
示例2: profile
public static function profile($sql, $time = 0)
{
if (KB_PROFILE == 2) {
file_put_contents(self::$qerrfile, $sql . "\nExecution time: " . $time . "\n", FILE_APPEND);
}
if (KB_PROFILE == 3) {
if (DB_TYPE == 'mysqli' && strtolower(substr($sql, 0, 6)) == 'select') {
$dbconn = new DBConnection();
$prof_out_ext = $prof_out_exp = '';
$prof_qry = mysqli_query($dbconn->id(), 'EXPLAIN extended ' . $sql . ";");
while ($prof_row = mysqli_fetch_assoc($prof_qry)) {
$prof_out_exp .= implode(' | ', $prof_row) . "\n";
}
$prof_qry = mysqli_query($dbconn->id(), 'show warnings');
while ($prof_row = mysqli_fetch_assoc($prof_qry)) {
$prof_out_ext .= implode(' | ', $prof_row) . "\n";
}
file_put_contents(self::$qerrfile, $sql . "\n" . $prof_out_ext . $prof_out_exp . "\n-- Execution time: " . $time . " --\n", FILE_APPEND);
} else {
file_put_contents(self::$qerrfile, $sql . "\nExecution time: " . $time . "\n", FILE_APPEND);
}
}
if (KB_PROFILE == 4) {
if ($time > 0.1 && strtolower(substr($sql, 0, 6)) == 'select') {
$dbconn = new DBConnection();
$prof_out_exp = $prof_out_exp = '';
$prof_qry = mysqli_query($dbconn->id(), 'EXPLAIN extended ' . $sql);
while ($prof_row = mysqli_fetch_assoc($prof_qry)) {
$prof_out_exp .= implode(' | ', $prof_row) . "\n";
}
$prof_qry = mysqli_query($dbconn->id(), 'show warnings');
while ($prof_row = mysqli_fetch_assoc($prof_qry)) {
$prof_out_ext .= implode(' | ', $prof_row) . "\n";
}
file_put_contents(self::$qerrfile, $sql . "\n" . $prof_out_ext . $prof_out_exp . "\n-- Execution time: " . $time . " --\n", FILE_APPEND);
}
}
}
示例3: find_SQL_Version
function find_SQL_Version()
{
$conn = new DBConnection();
$value = (double) mysqli_get_server_info($conn->id());
return $value;
}