本文整理汇总了PHP中DbUtil::switchToCountry方法的典型用法代码示例。如果您正苦于以下问题:PHP DbUtil::switchToCountry方法的具体用法?PHP DbUtil::switchToCountry怎么用?PHP DbUtil::switchToCountry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbUtil
的用法示例。
在下文中一共展示了DbUtil::switchToCountry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateDatabase
function updateDatabase()
{
global $labConfigId, $DB_HOST, $DB_USER, $DB_PASS;
$country = strtolower(LabConfig::getUserCountry($labConfigId));
$saved_db = DbUtil::switchToCountry($country);
$currentDir = getcwd();
$mainBlisDir = substr($currentDir, $length, strpos($currentDir, "htdocs"));
//$blisLabBackupFilePath = "\"".$mainBlisDir.$backup_folder."\blis_".$lab_config_id."\blis_".$lab_config_id."_backup.sql\"";
$sqlFilePath = "\"" . $mainBlisDir . "htdocs\\export\\temp.sql\"";
$mysqlExePath = "\"" . $mainBlisDir . "server\\mysql\\bin\\mysql.exe\"";
$dbname = "blis_" . $country;
$command = $mysqlExePath . " -h {$DB_HOST} -P 7188 -u {$DB_USER} -p{$DB_PASS} {$dbname} < {$sqlFilePath}";
$command = "C: &" . $command;
//the C: is a useless command to prevent the original command from failing because of having more than 2 double quotes
echo $command;
system($command, $return_var);
if ($return_var == 0) {
echo "true";
} else {
echo "false";
}
DbUtil::switchRestore($saved_db);
}
示例2: checkNameExists
public static function checkNameExists($name, $country)
{
# Checks if the given patient name (or similar match) already exists
$saved_db = DbUtil::switchToCountry($country);
$query_string = "SELECT COUNT(patient_id) AS val FROM patient WHERE name LIKE '%{$name}%'";
$resultset = query_associative_one($query_string);
DbUtil::switchRestore($saved_db);
if ($resultset == null || $resultset['val'] == 0) {
return false;
} else {
return true;
}
}
示例3: ScriptElems
<?php
include "../includes/db_lib.php";
include "../includes/script_elems.php";
$patientId = $_REQUEST['pid'];
$type = $_REQUEST['type'];
$script_elems = new ScriptElems();
$script_elems->enableTableSorter();
$script_elems->enableJQueryForm();
if ($type == 'national') {
$user = get_user_by_id($_SESSION['user_id']);
$country = strtolower($user->country);
$saved_db = DbUtil::switchToCountry($country);
$patient = Patient::getById($patientId);
DbUtil::switchRestore($saved_db);
$lab_config = LabConfig::getById($_SESSION['lab_config_id']);
?>
<table class='hor-minimalist-b' <?php
if ($width != "") {
echo " style='width:" . $width . "px;' ";
}
?>
>
<tbody>
<tr>
<td><u><?php
echo LangUtil::$generalTerms['NAME'];
?>
</u></td>
<td><?php
echo $patient->getName();