本文整理汇总了PHP中MySQLDatabase::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQLDatabase::connect方法的具体用法?PHP MySQLDatabase::connect怎么用?PHP MySQLDatabase::connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySQLDatabase
的用法示例。
在下文中一共展示了MySQLDatabase::connect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connect
/**
* Catches the too many connections error and sets a file system lock.
*/
protected function connect()
{
try {
parent::connect();
} catch (DatabaseException $e) {
if (defined("COOKIE_PREFIX") && isset($_COOKIE[COOKIE_PREFIX . 'userID']) && $_COOKIE[COOKIE_PREFIX . 'userID']) {
LWUtil::lockAccount(intval($_COOKIE[COOKIE_PREFIX . 'userID']), 10);
}
// throw again...
throw $e;
}
}
示例2: FileCache
// Validate the input parameters
if (is_numeric($tllon) && -180.0 <= $tllon && $tllon < 180.0 && is_numeric($tllat) && -90.0 <= $tllat && $tllat <= 90.0 && is_numeric($brlon) && -180.0 <= $brlon && $brlon < 180.0 && is_numeric($brlat) && -90.0 <= $brlat && $brlat <= 90.0 && is_numeric($zoom) && $zoom >= 0 && $zoom < 20) {
$min_lat = $tllat < $brlat ? $tllat : $brlat;
$max_lat = $tllat > $brlat ? $tllat : $brlat;
$min_lon = $tllon < $brlon ? $tllon : $brlon;
$max_lon = $tllon > $brlon ? $tllon : $brlon;
$key = "poi_" . $min_lat . "_" . $max_lat . "_" . $min_lon . "_" . $max_lon . "_" . $zoom;
if (strcmp($cache_type, "FileCache") == 0) {
$cache = new FileCache();
} else {
$cache = new NoCache();
}
$xml = $cache->get($key);
if ($xml == FALSE) {
$db = new MySQLDatabase($hostname, $database, $username, $password);
$db->connect();
$poi = new POIManager($db);
$gpx = $poi->getWpts($min_lat, $max_lat, $min_lon, $max_lon, $zoom);
$xml = $gpx->toXml();
$db->disconnect();
$cache->put($key, $xml);
}
header("Content-type: text/xml; charset=utf-8");
print $xml;
} else {
header("Content-type: text/plain; charset=utf-8");
print "Invalid Input";
}
} else {
header("Content-type: text/plain; charset=utf-8");
print "Unsupported Action";