本文整理汇总了PHP中DBC::getCurrentConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP DBC::getCurrentConnection方法的具体用法?PHP DBC::getCurrentConnection怎么用?PHP DBC::getCurrentConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBC
的用法示例。
在下文中一共展示了DBC::getCurrentConnection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeLiteral
/**
* EXPERIMENTAL:
* Convert a PHP value into an SQL literal.
* @return resource MySQL result resource
* @param mixed value to convert
* @param string (optional) type to convert to
* @access public
*/
function makeLiteral($value, $type = NULL)
{
$connection = DBC::getCurrentConnection();
return $connection->makeLiteral($value, $type);
}
示例2: phpAds_PageHeader
/*-------------------------------------------------------*/
phpAds_PageHeader("updates-index");
phpAds_MaintenanceSelection("product", "updates");
/*-------------------------------------------------------*/
/* Main code */
/*-------------------------------------------------------*/
// Determine environment
$doApplicationVariable = OA_Dal::factoryDO('application_variable');
$doApplicationVariable->name = 'oa_version';
$doApplicationVariable->find();
$doApplicationVariable->fetch();
$current = $strCurrentlyUsing . ' ' . MAX_PRODUCT_NAME . ' v' . OA_VERSION . ' ' . ($doApplicationVariable->value != OA_VERSION ? '(warning: database is stamped as v' . $doApplicationVariable->value . ') ' : '');
$current .= $strRunningOn . ' ' . str_replace('/', ' ', ereg_replace(" .*\$", '', $_SERVER["SERVER_SOFTWARE"])) . ', ';
$current .= 'PHP ' . phpversion() . ' ' . $strAndPlain . ' ' . phpAds_dbmsname;
// Get the database version number.
$connection = DBC::getCurrentConnection();
$connectionId = $connection->getConnectionId();
$aVersion = $connectionId->getServerVersion();
$current .= ' ' . $aVersion['major'] . '.' . $aVersion['minor'] . '.' . $aVersion['patch'] . '-' . $aVersion['extra'];
echo "<br />" . $current . ".<br /><br />";
phpAds_ShowBreak();
if (!isset($session['maint_update'])) {
if (function_exists('xml_parser_create')) {
// Show wait please text with rotating logo
echo "<br />";
echo "<table border='0' cellspacing='1' cellpadding='2'><tr><td>";
echo "<img src='" . OX::assetPath() . "/images/install-busy.gif' width='16' height='16'>";
echo "</td><td class='install'>" . $strSearchingUpdates . "</td></tr></table>";
// Send the output to the browser
if (false !== ob_get_contents()) {
ob_flush();
示例3: phpAds_sqlDie
function phpAds_sqlDie()
{
global $phpAds_last_query;
$corrupt = false;
$aConf = $GLOBALS['_MAX']['CONF'];
if (strcasecmp($aConf['database']['type'], 'mysql') === 0) {
$error = mysql_error();
$errornumber = mysql_errno();
if ($errornumber == 1027 || $errornumber == 1039) {
$corrupt = true;
}
if ($errornumber == 1016 || $errornumber == 1030) {
// Probably corrupted table, do additional check
preg_match("/[0-9]+/Di", $error, $matches);
if ($matches[0] == 126 || $matches[0] == 127 || $matches[0] == 132 || $matches[0] == 134 || $matches[0] == 135 || $matches[0] == 136 || $matches[0] == 141 || $matches[0] == 144 || $matches[0] == 145) {
$corrupt = true;
}
}
$dbmsName = 'MySQL';
} elseif (strcasecmp($aConf['database']['type'], 'pgsql') === 0) {
$error = pg_errormessage();
$dbmsName = 'PostgreSQL';
} else {
$error = '';
$dbmsName = 'Unknown';
}
if ($corrupt) {
$title = $GLOBALS['strErrorDBSerious'];
$message = sprintf($GLOBALS['strErrorDBNoDataSerious'], PRODUCT_NAME);
if (OA_Auth::isLoggedIn() && OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
$message .= " (" . $error . ").<br><br>" . $GLOBALS['strErrorDBCorrupt'];
} else {
$message .= ".<br>" . $GLOBALS['strErrorDBContact'];
}
} else {
$title = $GLOBALS['strErrorDBPlain'];
$message = sprintf($GLOBALS['strErrorDBNoDataPlain'], PRODUCT_NAME);
if (OA_Auth::isLoggedIn() && (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) || defined('phpAds_installing')) {
// Get the DB server version
$connection = DBC::getCurrentConnection();
$connectionId = $connection->getConnectionId();
$aVersion = $connectionId->getServerVersion();
$dbVersion = $aVersion['major'] . '.' . $aVersion['minor'] . '.' . $aVersion['patch'] . '-' . $aVersion['extra'];
$message .= sprintf($GLOBALS['strErrorDBSubmitBug'], PRODUCT_NAME);
$last_query = $phpAds_last_query;
$message .= "<br><br><table cellpadding='0' cellspacing='0' border='0'>";
$message .= "<tr><td valign='top' nowrap><b>Version:</b> </td><td>" . htmlspecialchars(PRODUCT_NAME) . " v" . htmlspecialchars(VERSION) . "</td></tr>";
$message .= "<tr><td valien='top' nowrap><b>PHP/DB:</b></td><td>PHP " . phpversion() . " / " . $dbmsName . " " . $dbVersion . "</td></tr>";
$message .= "<tr><td valign='top' nowrap><b>Page:</b></td><td>" . htmlspecialchars($_SERVER['PHP_SELF']) . "</td></tr>";
$message .= "<tr><td valign='top' nowrap><b>Error:</b></td><td>" . htmlspecialchars($error) . "</td></tr>";
$message .= "<tr><td valign='top' nowrap><b>Query:</b></td><td><pre>" . htmlspecialchars($last_query) . "</pre></td></tr>";
$message .= "<tr><td valign='top' nowrap><b>\$_POST:</b></td><td><pre>" . (empty($_POST) ? 'Empty' : htmlspecialchars(print_r($_POST, true))) . "</pre></td></tr>";
$message .= "<tr><td valign='top' nowrap><b>\$_GET:</b></td><td><pre>" . (empty($_GET) ? 'Empty' : htmlspecialchars(print_r($_GET, true))) . "</pre></td></tr>";
$message .= "</table>";
}
}
phpAds_Die($title, $message);
}