本文整理汇总了PHP中DbUtil类的典型用法代码示例。如果您正苦于以下问题:PHP DbUtil类的具体用法?PHP DbUtil怎么用?PHP DbUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DbUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: serializeRoutes
public static function serializeRoutes($routes)
{
$results = [];
foreach ($routes as $route) {
$results[] = DbUtil::serializeRoute($route);
}
return $results;
}
示例2: retrieveOrganizationName
public static function retrieveOrganizationName()
{
$db = DbUtil::accessFactory();
$copname = Auth::getCopName();
$copname = $db->escape($copname);
$rs = $db->select("SELECT coplabel FROM cops WHERE copname = '{$copname}'");
return $rs->coplabel;
}
示例3: get_records_to_print
function get_records_to_print($lab_config, $test_type_id, $date_from, $date_to)
{
$saved_db = DbUtil::switchToLabConfig($lab_config->id);
$retval = array();
$query_string = "SELECT * FROM test WHERE test_type_id={$test_type_id} " . "AND specimen_id IN ( " . "SELECT specimen_id FROM specimen " . "WHERE date_collected BETWEEN '{$date_from}' AND '{$date_to}' " . ")";
$resultset = query_associative_all($query_string, $row_count);
foreach ($resultset as $record) {
$test = Test::getObject($record);
$specimen = Specimen::getById($test->specimenId);
$patient = Patient::getById($specimen->patientId);
$retval[] = array($test, $specimen, $patient);
}
DbUtil::switchRestore($saved_db);
return $retval;
}
示例4: getMailUsers
function getMailUsers()
{
$idAlbum = 1;
$sql = "SELECT al.key as albumkey, ur.id as srcid, ur.email as srcemail, concat(ur.firstname, \" \", ur.lastname) as srcfullname, j.uid, j.email, j.fullname, j.idstickers \n \t\tFROM user ur, (SELECT m.idalbum, d.iduser as srcuser, m.iduser as uid, concat(u.firstname, \" \", u.lastname) as fullname,\n\t\t\t\t\t\t\t\t\tu.email, group_concat(d.stickernumber ORDER BY d.stickernumber SEPARATOR ', ') as idstickers \n\t\t\t\t\t\t\t\tFROM missing m \n\t\t\t\t\t\t\t\tJOIN duplicate d on m.stickernumber = d.stickernumber\n\t\t\t\t\t\t\t\t\tand m.idalbum = d.idalbum and d.copy > 0 \n\t\t\t\t\t\t\t\tJOIN user u on u.id = m.iduser and u.id != d.iduser\n\t\t\t\t\t\t\t\tWHERE u.active=1\n\t\t\t\t\t\t\t\tGROUP BY m.iduser, d.iduser) as j\n\t\tJOIN album al on al.id=j.idalbum\n\t\tWHERE j.srcuser = ur.id and ur.active=1\n\t\t";
$connection = DbUtil::getConnection();
$sql_result = mysqli_query($connection, $sql);
$info = array();
while ($sql_row = mysqli_fetch_array($sql_result)) {
$srcId = $sql_row['srcid'];
$albumKey = $sql_row['albumkey'];
if (!isset($info[$srcId])) {
$info[$srcId] = array();
$info[$srcId]["email"] = $sql_row['srcemail'];
$info[$srcId]["fullname"] = $sql_row['srcfullname'];
}
if (!isset($info[$srcId]["albums"])) {
$info[$srcId]["albums"] = array();
}
if (!isset($info[$srcId]["albums"][$albumKey])) {
$info[$srcId]["albums"][$albumKey] = array();
}
$info[$srcId]["albums"][$albumKey]["key"] = $albumKey;
if (!isset($info[$srcId]["albums"][$albumKey]["neededBy"])) {
$info[$srcId]["albums"][$albumKey]["neededBy"] = array();
}
$info[$srcId]["albums"][$albumKey]["neededBy"][] = array('id' => $sql_row['uid'], 'name' => $sql_row['fullname'], 'stickers' => $sql_row['idstickers']);
$srcId = $sql_row['uid'];
if (!isset($info[$srcId])) {
$info[$srcId] = array();
$info[$srcId]["email"] = $sql_row['email'];
$info[$srcId]["fullname"] = $sql_row['fullname'];
}
if (!isset($info[$srcId]["albums"])) {
$info[$srcId]["albums"] = array();
}
if (!isset($info[$srcId]["albums"][$albumKey])) {
$info[$srcId]["albums"][$albumKey] = array();
$info[$srcId]["albums"][$albumKey]["key"] = $albumKey;
}
if (!isset($info[$srcId]["albums"][$albumKey]["hasStickers4You"])) {
$info[$srcId]["albums"][$albumKey]["hasStickers4You"] = array();
}
$info[$srcId]["albums"][$albumKey]["hasStickers4You"][] = array('id' => $sql_row['srcid'], 'name' => $sql_row['srcfullname'], 'stickers' => $sql_row['idstickers']);
}
return $info;
}
示例5: generate_worksheet_config
function generate_worksheet_config($lab_config_id)
{
$lab_config = LabConfig::getById($lab_config_id);
$test_ids = $lab_config->getTestTypeIds();
$saved_db = DbUtil::switchToLabConfig($lab_config_id);
foreach ($test_ids as $test_id) {
$test_entry = TestType::getById($test_id);
$query_string = "SELECT * FROM report_config WHERE test_type_id={$test_id} LIMIT 1";
$record = query_associative_one($query_string);
if ($record == null) {
# Add new entry
$query_string_add = "INSERT INTO report_config (" . "test_type_id, header, footer, margins, " . "p_fields, s_fields, t_fields, p_custom_fields, s_custom_fields " . ") VALUES (" . "'{$test_id}', 'Worksheet - " . $test_entry->name . "', '', '5,0,5,0', " . "'0,1,0,1,1,0,0', '0,0,1,1,0,0', '1,0,1,0,0,0,0,1', '', '' " . ")";
query_insert_one($query_string_add);
}
}
DbUtil::switchRestore($saved_db);
}
示例6: mergedata
function mergedata()
{
if (!isset($_SESSION['lab_config_id'])) {
return false;
}
$workedID = "";
$lab_config = $_SESSION['lab_config_id'];
$saved_db = DbUtil::switchToLabConfig($importLabConfigId);
$querySelect = "SELECT patient_id,name,surr_id,addl_id FROM patient order by surr_id asc";
$resultset = query_associative_all($querySelect, $rowCount);
$rowCount = 0;
foreach ($resultset as $record) {
if (strstr($workedID, $record['surr_id'])) {
continue;
} else {
$workedID .= "," . $record['surr_id'];
}
$querySelect = "SELECT patient_id,name,surr_id,addl_id FROM patient where \n\t\tsurr_id='" . $record['surr_id'] . "' and \n\t\tpatient_id <> " . $record['patient_id'];
$Dupresult = query_associative_all($querySelect, $rowCount);
foreach ($Dupresult as $Duprecord) {
$rowCount += 1;
echo '<br> Working... ' . $record['surr_id'];
//update spacimen
$updateQuery = "update specimen set patient_id=" . $record['patient_id'] . "where patient_id=" . $Duprecord['patient_id'];
query_blind($updateQuery);
//update bills
$updateQuery = "update bills set patient_id=" . $record['patient_id'] . "where patient_id=" . $Duprecord['patient_id'];
query_blind($updateQuery);
//now delete from custom_data and patients table
$deleteQuery = "delete from patient_custom_data where patient_id=" . $Duprecord['patient_id'];
query_blind($deleteQuery);
$deleteQuery = "delete from patient where patient_id=" . $Duprecord['patient_id'];
query_blind($deleteQuery);
}
}
//var_dump ( $resultset);
if ($rowCount > 0) {
echo '<br>' . $rowCount . " Duplicate Records corrected.";
} else {
echo '<br>' . "No Duplicate Records found.";
}
return true;
}
示例7: 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);
}
示例8:
<?php
#
# Deletes a test type from DB
# Sets disabled flag to true instead of deleting the record
# This maintains info for samples that were linked to this test type previously
#
include "../includes/db_lib.php";
$saved_session = SessionUtil::save();
$saved_db = DbUtil::switchToGlobal();
$test_type_id = $_REQUEST['id'];
TestType::deleteById($test_type_id);
DbUtil::switchRestore($saved_db);
SessionUtil::restore($saved_session);
header("Location: catalog.php?tdel");
示例9: DbUtil
<!DOCTYPE html>
<?php
require_once '../db.php';
$Database = new DbUtil();
$userName = $Database->getUserName();
if ($userName == null) {
header('Location: ../login.php', true, 303);
exit;
}
$ID = $_GET['sid'];
$LINE = $_GET['lid'];
$stopData = $Database->getStop($ID);
$lineName = $Database->getLineName($LINE, $userName);
if ($lineName == null) {
die('PERMISSION DENIED');
}
$timeData = $_GET['time'];
$typeData = $_GET['type'];
if ($Database->isExistTime($ID, $LINE, $timeData, $typeData)) {
$Database->deleteTime($ID, $LINE, $timeData, $typeData);
}
header("Location: timetable.php?stopid={$ID}&lineid={$LINE}", true, 303);
示例10: exists
/**
* Verifies if a Widget Category with a given name exists in the
* persistent database of the portal.
*
* @param string $name The name of the Widget Category you want to verify the existence.
*/
public static function exists($name)
{
$db = DbUtil::accessFactory();
$name = $db->escape($name);
$toLowerName = strtolower($name);
// Check if this category exists.
$rs = $db->select("SELECT COUNT(*) AS 'catcount' FROM categories WHERE LOWER(category) = '{$toLowerName}'");
return $rs->catcount;
}
示例11: DbUtil
<?php
//BLIR BRUKT I ADMIN
require_once 'inc/dbutil.php';
$obj = new DbUtil();
$tmpVal = $obj->getTable();
echo "<p class='text-center'>Guild Members</p>";
echo "<table class='table'>";
echo "<tr><th>Character name</th><th>Remove player</th></tr>";
foreach ($tmpVal as $row) {
if ($row['guildmembership'] == 1 && $row['gamerID'] != $_SESSION['gamerID']) {
echo "<tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>";
echo "<form action='inc/deleteuser.php' method='post'>";
echo "<input type='hidden' name='deleteuser' value='" . $row['gamerID'] . "'>";
echo "<button type='submit' class='btn btn-danger' >Delete</button>";
echo "</form>";
echo "</td>";
echo "</tr>";
}
}
echo "</table>";
示例12: DbUtil
<?php
$USER = @$_POST['username'];
$PASS = @$_POST['pass'];
$DO = @$_GET['do'];
$ERROR = "";
$USERHAS = "";
$PASSHAS = "";
$showForm = true;
require_once 'db.php';
$Database = new DbUtil();
if ($Database->getUserName() != null) {
header('Location: personal/my.php', true, 303);
}
function login()
{
global $DO, $PASS, $USER, $ERROR, $USERHAS, $PASSHAS, $Database;
if ($DO != "") {
if ($USER == "" || $PASS == "") {
$ERROR = '<div class="alert alert-danger" role="alert">一部または全ての項目が入力されていません</div>';
if ($USER == "") {
$USERHAS = "has-error";
}
if ($PASS == "") {
$PASSHAS = "has-error";
}
} else {
if (!$Database->login($USER, $PASS)) {
$ERROR = '<div class="alert alert-danger" role="alert">ユーザ名またはパスワードが違います</div>';
} else {
$showForm = false;
示例13: DbUtil
<!DOCTYPE html>
<?php
require_once '../nav.php';
require_once '../db.php';
require_once 'sidemenu.php';
$DO = @$_GET['do'];
$EDIT = @$_GET['edit'];
$DELETE = @$_GET['delete'];
$Database = new DbUtil();
$userName = $Database->getUserName();
if ($DO != "") {
$stopName = $_POST['stopName'];
if ($_POST['stopSelect'] == 'new') {
$lineName = $_POST['newName'];
} else {
$lineName = $_POST['existSelect'];
}
$lat = @$_POST['lat'];
$long = @$_POST['long'];
$lineId = $Database->getLineId($lineName, $userName);
if ($lineId == null) {
$Database->registerLine($lineName, $userName);
$lineId = $Database->getLineId($lineName, $userName);
}
if ($lat == '') {
$lat = '0';
$long = '0';
}
if ($EDIT == "") {
$Database->registerStop($stopName, $userName, $long, $lat);
} else {
示例14: dirname
<?php
require dirname(__FILE__) . '/__init__.php';
Rhaco::import('tag.HtmlParser');
$db = new DbUtil(Event::connection());
$p = new HtmlParser('index.html');
$p->setVariable('event', $db->get(new Event(), new C(Q::depend(), Q::eq(Event::columnId(), Rhaco::constant('CURRENT_EVENT', 1)))));
$p->setVariable('hatena', Rhaco::obj('HatenaSyntax', array('headlevel' => 4, 'id' => 'event_description')));
$p->write();
示例15: DbUtil
<!DOCTYPE html>
<?php
require_once '../nav.php';
require_once '../db.php';
require_once 'sidemenu.php';
require_once 'funcs.php';
$Database = new DbUtil();
$userName = $Database->getUserName();
$sideMenu = getSideMenu('my');
$NAV = nav($userName);
if ($userName == null) {
header('Location: ../login.php', true, 303);
exit;
}
if ($_GET['type'] == 'close') {
$closeList = true;
$lat = $_GET['lat'];
$long = $_GET['long'];
$noPos = false;
if ($lat == "" || $long == "") {
$noPos = true;
}
} else {
$closeList = false;
}
if (!$closeList) {
$myData = $Database->getMyTime($userName, get4Time() - 5, getTodayType());
} else {
$myStopList = $Database->getCloseStopList($userName, $lat, $long);
}
?>