本文整理汇总了PHP中getPDOConnection函数的典型用法代码示例。如果您正苦于以下问题:PHP getPDOConnection函数的具体用法?PHP getPDOConnection怎么用?PHP getPDOConnection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getPDOConnection函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: update
public function update()
{
// validation check
if (!is_null($this->desirePercent)) {
if ($this->desirePercent > 100.0) {
$this->desirePercent = 100.0;
}
if ($this->desirePercent < 0.0) {
$this->desirePercent = 0.0;
}
$this->desirePercent = round($this->desirePercent);
}
// now onto the update
try {
$dbh = getPDOConnection();
$dbh->beginTransaction();
$stmt = $dbh->prepare("UPDATE shiftpreference SET desirePercent = ? " . " WHERE workerid = ? AND jobid = ?");
$stmt->execute(array($this->desirePercent, $this->workerid, $this->jobid));
$dbh->commit();
return $this;
} catch (PDOException $pe) {
logMessage('ShiftPreference::update()', $pe->getMessage());
throw $pe;
}
}
开发者ID:ConSked,项目名称:scheduler,代码行数:25,代码来源:ShiftPreference.php
示例2: updateAdressByDne
function updateAdressByDne($config)
{
$pdo = getPDOConnection($config);
$pdo->beginTransaction();
$wrong = $pdo->query("select id, cep, city_id, adress from person where cep is not null ");
if (!$wrong) {
print_r($pdo->errorInfo());
return false;
}
$stm1 = $pdo->prepare("update person set country_id = ?, state_id = ?, city_id = ?, adress = ? where id = ?");
$stm2 = $pdo->prepare("select a1.id, a1.state_id, a2.country_id from city a1 inner join state a2 on a1.state_id = a2.id where a1.stat = ?");
$stm3 = $pdo->prepare('select a1.id, a1.state_id, a2.country_id from city a1 inner join state a2 on a1.state_id = a2.id where a2.iso6 = ? and translate(lower(a1.name),\'áàâãäāéèêëíìïóòôõöúùûüūÁÀÂÃÄĀÉÈÊËÍÌÏÓÒÔÕÖÚÙÛÜŪçÇ‘\',\'aaaaaaeeeeiiiooooouuuuuAAAAAAEEEEIIIOOOOOUUUUUcC\') = translate(lower(?),\'áàâãäāéèêëíìïóòôõöúùûüūÁÀÂÃÄĀÉÈÊËÍÌÏÓÒÔÕÖÚÙÛÜŪçÇ‘\',\'aaaaaaeeeeiiiooooouuuuuAAAAAAEEEEIIIOOOOOUUUUUcC\')');
$dne = new DneHelper();
foreach ($wrong as $person) {
$ceps = $dne->findByCep($person['cep']);
if ($ceps) {
if (is_numeric($ceps['codigoMunIBGE'])) {
if ($ceps['codigoMunIBGE'] === 0) {
if (!$stm3->execute(array('BR-' . $ceps['state'], $ceps['infoAdicional']))) {
print_r($pdo->errorInfo());
return false;
}
if ($res = $stm3->fetchAll()) {
if (!$stm1->execute(array($res[0]['country_id'], $res[0]['state_id'], $res[0]['id'], $ceps['localidade'], $person['id']))) {
print_r($pdo->errorInfo());
return false;
}
}
} else {
if (!$stm2->execute(array($ceps['codigoMunIBGE']))) {
print_r($pdo->errorInfo());
return false;
}
if ($res = $stm2->fetchAll()) {
if (!$stm1->execute(array($res[0]['country_id'], $res[0]['state_id'], $res[0]['id'], $ceps['logradouroExtenso'], $person['id']))) {
print_r($pdo->errorInfo());
return false;
}
}
}
} else {
print_r('dunno');
return false;
}
} elseif (is_numeric($person['city_id']) && $person['city_id'] == 0) {
if (!$stm1->execute(array(null, null, null, null, $person['id']))) {
print_r($pdo->errorInfo());
return false;
}
}
}
$pdo->commit();
return true;
}
开发者ID:dricaveloso,项目名称:id-cultura,代码行数:54,代码来源:lc_updateByDne.php
示例3: simpleSelect
/**
* This method opens a connection, sets up the sql, injects the paramArray, and creates className instances.
* Note it still throws the PDOException for handling.
*
* Usage: simpleSelect("Worker", "SELECT * FROM worker WHERE workerid = ?", array($workerid));
*/
function simpleSelect($className, $sql, $paramArray = NULL)
{
$dbh = getPDOConnection();
$stmt = $dbh->prepare($sql);
if (is_null($paramArray)) {
$stmt->execute();
} else {
$stmt->execute($paramArray);
}
$rows = $stmt->fetchAll(PDO::FETCH_CLASS, $className);
return 0 != count($rows) ? $rows : array();
}
开发者ID:ConSked,项目名称:scheduler,代码行数:18,代码来源:dbutil.php
示例4: insert
public static function insert($date)
{
try {
$dbh = getPDOConnection();
$dbh->beginTransaction();
$stmt = $dbh->prepare("INSERT INTO remindersent (date) VALUES (?)");
$stmt->execute(array($date));
$dbh->commit();
return;
} catch (PDOException $pe) {
logMessage('ReminderSend::insert(' . $date . ')', $pe->getMessage());
}
}
开发者ID:ConSked,项目名称:scheduler,代码行数:13,代码来源:ReminderSent.php
示例5: tableSchema
private static function tableSchema($table)
{
$sql = "DESCRIBE {$table}";
try {
$dbh = getPDOConnection();
$stmt = $dbh->prepare($sql);
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $pe) {
logMessage("Report::tableSchema({$table})", $pe->getMessage());
return array();
}
}
开发者ID:ConSked,项目名称:scheduler,代码行数:13,代码来源:report.php
示例6: update
public function update()
{
try {
$dbh = getPDOConnection();
$dbh->beginTransaction();
$stmt = $dbh->prepare("UPDATE timepreference SET shift1 = ?, shift2 = ?, shift3 = ?, shift4 = ?, shift5 = ?, shift6 = ?, shift7 = ?, shift8 = ?, shift9 = ? , shift10 = ?, " . "shift11 = ?, shift12 = ?, shift13 = ?, shift14 = ?, shift15 = ?, shift16 = ?, shift17 = ?, shift18 = ?, shift19 = ?, shift20 = ? " . "WHERE workerid = ?");
$stmt->execute(array($this->shift1, $this->shift2, $this->shift3, $this->shift4, $this->shift5, $this->shift6, $this->shift7, $this->shift8, $this->shift9, $this->shift10, $this->shift11, $this->shift12, $this->shift13, $this->shift14, $this->shift15, $this->shift16, $this->shift17, $this->shift18, $this->shift19, $this->shift20, $this->workerid));
$dbh->commit();
return $this;
} catch (PDOException $pe) {
logMessage('TimePreference::update()', $pe->getMessage());
}
}
开发者ID:ConSked,项目名称:scheduler,代码行数:13,代码来源:TimePreference.php
示例7: update
public function update()
{
try {
$dbh = getPDOConnection();
$dbh->beginTransaction();
$stmt = $dbh->prepare("UPDATE jobpreference SET job1 = ?, job2 = ?, job3 = ?, job4 = ?, job5 = ?, job6 = ?, job7 = ?, job8 = ?, job9 = ?, job10 = ?, " . "job11 = ?, job12 = ?, job13 = ?, job14 = ?, job15 = ?, job16 = ?, job17 = ?, job18 = ?, job19 = ?, job20 = ? " . "WHERE workerid = ?");
$stmt->execute(array($this->job1, $this->job2, $this->job3, $this->job4, $this->job5, $this->job6, $this->job7, $this->job8, $this->job9, $this->job10, $this->job11, $this->job12, $this->job13, $this->job14, $this->job15, $this->job16, $this->job17, $this->job18, $this->job19, $this->job20, $this->workerid));
$dbh->commit();
return $this;
} catch (PDOException $pe) {
logMessage('JobPreference::update()', $pe->getMessage());
}
}
开发者ID:ConSked,项目名称:scheduler,代码行数:13,代码来源:JobPreference.php
示例8: GetServers
function GetServers()
{
include_once dirname(__FILE__) . "/getPDO.php";
include_once dirname(__FILE__) . "/PDOQuery.php";
$pdo = getPDOConnection();
$query = "SELECT * FROM `soe-csgo`.`utils_servers` ORDER BY order_priority;";
$result = getPDOQueryResult($pdo, $query, __FILE__, __LINE__);
$res = array();
foreach ($result as $row) {
$res[$row["server_id"]] = $row;
}
return $res;
}
开发者ID:ezpz-cz,项目名称:web-pages,代码行数:13,代码来源:servers.php
示例9: delete
public function delete()
{
try {
$dbh = getPDOConnection();
$dbh->beginTransaction();
$stmt = $dbh->prepare("DELETE FROM jobtitle WHERE expoid = ? AND jobtitle = ?");
$stmt->execute(array($this->expoid, $this->jobTitle));
$dbh->commit();
return $this;
} catch (PDOException $pe) {
logMessage('JobTitle::delete()', $pe->getMessage());
}
}
开发者ID:ConSked,项目名称:scheduler,代码行数:13,代码来源:JobTitle.php
示例10: checkAdminForReportByReportId
function checkAdminForReportByReportId($report_id)
{
session_start();
$pdo = getPDOConnection();
$query = "SELECT admin_id FROM `ezpz-report-g`.`report_report` WHERE id = :report_id";
$admin_id = getPDOParametrizedQueryScalarValue($pdo, $query, array(":report_id" => $report_id), __FILE__, __LINE__);
if (!$admin_id) {
throw new Exception("Cannot get the admin_id!");
}
if ($_SESSION['ezpz_sb_admin_id'] == $admin_id) {
return True;
} else {
return False;
}
}
开发者ID:ezpz-cz,项目名称:web-pages,代码行数:15,代码来源:checkAdmin.php
示例11: getAdminsReports
function getAdminsReports()
{
try {
include_once "/data/web/virtuals/93680/virtual/www/domains/ezpz.cz/ext/phpbb/pages/styles/pbtech/template/scripts-generic/getPDO.php";
include_once "/data/web/virtuals/93680/virtual/www/domains/ezpz.cz/ext/phpbb/pages/styles/pbtech/template/scripts-generic/PDOQuery.php";
// get admin ids and names
$pdo = getPDOConnection();
$result = getPDOQueryResult($pdo, "SELECT id, name FROM `soe-csgo`.sb_admins WHERE active = 1", __FILE__, __LINE__);
$admins = array();
foreach ($result as $row) {
$admins[$row["id"]] = array("name" => $row["name"]);
}
// get new and finished report counts
$query = "SELECT a.active, a.id, a.name, COUNT(*) as count_report_new\n FROM `soe-csgo`.sb_admins AS a\n JOIN `ezpz-report-g`.report_report AS r ON r.admin_id = a.id\n WHERE (r.status_id = 1 OR r.status_id = 2) AND a.active = 1\n GROUP BY a.id";
$result = getPDOQueryResult($pdo, $query, __FILE__, __LINE__);
foreach ($result as $row) {
$admins[$row["id"]]["count_report_new"] = !is_null($row["count_report_new"]) ? $row["count_report_new"] : 0;
}
$query = "SELECT a.active, a.id, COUNT(*) as count_report_finished\n FROM `soe-csgo`.sb_admins AS a\n JOIN `ezpz-report-g`.report_report AS r ON r.admin_id = a.id\n WHERE (r.status_id = 3 OR r.status_id = 4 OR r.status_id = 5) AND a.active = 1\n GROUP BY a.id";
$result = getPDOQueryResult($pdo, $query, __FILE__, __LINE__);
foreach ($result as $row) {
$admins[$row["id"]]["count_report_finished"] = !is_null($row["count_report_finished"]) ? $row["count_report_finished"] : 0;
}
$admins_new = array();
foreach ($admins as $key => $value) {
if (!array_key_exists("count_report_new", $value)) {
$admins[$key]["count_report_new"] = 0;
}
if (!array_key_exists("count_report_finished", $value)) {
$admins[$key]["count_report_finished"] = 0;
}
$admins_new[] = array("admin_id" => $key, "count_report_new" => $admins[$key]["count_report_new"], "count_report_finished" => $admins[$key]["count_report_finished"], "name" => $admins[$key]["name"]);
}
return $admins_new;
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
开发者ID:ezpz-cz,项目名称:report-system,代码行数:38,代码来源:admins.php
示例12: array
$params = array();
if (!is_null($lname)) {
$sql .= " lastName LIKE lower(?) ";
$params[] = "%" . $lname . "%";
}
if (!is_null($email)) {
if (!is_null($lname)) {
$sql .= " OR ";
}
$sql .= " email LIKE lower(?) ";
$params[] = "%" . $email . "%";
}
$sql .= " ORDER BY lastName ASC, email ASC";
if (count($params) > 0) {
try {
$dbh = getPDOConnection();
$stmt = $dbh->prepare($sql);
$stmt->execute($params);
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (1 == count($rows)) {
$stationid = $rows[0]['stationid'];
}
} catch (PDOException $pe) {
logMessage("SnapShotWorker - {$lname}, {$email}", $pe->getMessage());
}
}
}
?>
<!DOCTYPE html>
<html>
开发者ID:ConSked,项目名称:scheduler,代码行数:31,代码来源:SnapShotStation.php
示例13: update
public function update()
{
try {
$dbh = getPDOConnection();
$dbh->beginTransaction();
$stmt = $dbh->prepare("UPDATE expo SET startTime = ?, stopTime = ?, " . " expoHourCeiling = ?, title = ?, description = ?, " . " scheduleAssignAsYouGo = ?, scheduleVisible = ?, " . " allowScheduleTimeConflict = ?, newUserAddedOnRegistration = ? " . " WHERE expoid = ?");
if (is_null($this->startTime)) {
$this->startTime = new DateTime();
}
if (is_null($this->stopTime)) {
$this->stopTime = new DateTime();
}
$stmt->execute(array(swwat_format_isodatetime($this->startTime), swwat_format_isodatetime($this->stopTime), $this->expoHourCeiling, $this->title, $this->description, $this->scheduleAssignAsYouGo, $this->scheduleVisible, $this->allowScheduleTimeConflict, $this->newUserAddedOnRegistration, $this->expoid));
$dbh->commit();
return $this;
} catch (PDOException $pe) {
logMessage('Expo::update()', $pe->getMessage());
}
}
开发者ID:ConSked,项目名称:scheduler,代码行数:19,代码来源:Expo.php
示例14: updateHelper_Location_DateSpan
/**
* This method presumes arrays of the following and calls updateRaw to update the db.
*
* $locationDesires = array('registration desk'->23, 'lobby'->50);
* $dateSpanDesires = array('2012-10-02 10:00 - 11:00'->NULL, '2012-10-02 12:00 - 12:00'->100);
*/
public static function updateHelper_Location_DateSpan($expoId, $workerId, array $locationDesires, array $dateSpanDesires)
{
$locationKeys = array_keys($locationDesires);
$dateSpanKeys = array_keys($dateSpanDesires);
try {
$updates = 0;
$dbh = getPDOConnection();
$dbh->beginTransaction();
foreach ($locationKeys as $location) {
$desireLocation = $locationDesires[$location];
foreach ($dateSpanKeys as $dateSpanKey) {
$desireDateSpan = $dateSpanDesires[$dateSpanKey];
// the formula in update raw = (dD + tD)/2; in this case D = (D+D)/2
$dateTimeTime = self::parseDateSpanKey($dateSpanKey);
$updates += self::updateRaw($dbh, $desireLocation, $desireDateSpan, $desireDateSpan, $expoId, $workerId, $location, $dateTimeTime[0], $dateTimeTime[1], $dateTimeTime[2]);
}
// $dateSpanKey
}
// $location
$dbh->commit();
return $updates;
} catch (PDOException $pe) {
logMessage("GrossPreference::updateHelper_Location_DateSpan({$expoId}, {$workerId}, ...)", $pe->getMessage());
throw $pe;
}
}
开发者ID:ConSked,项目名称:scheduler,代码行数:32,代码来源:GrossPreference.php
示例15: update
public function update()
{
try {
// Create the query
$update_query = "UPDATE jobpreference SET";
for ($i = 1; $i <= NUMBER_JOBS; $i++) {
$update_query .= " job" . $i . " = ?,";
}
$update_query = rtrim($update_query, ",");
$update_query .= " WHERE workerid = ? AND expoid = ?";
// Create the input array
$update_array = array();
for ($i = 1; $i <= NUMBER_JOBS; $i++) {
$job = "job" . $i;
array_push($update_array, $this->{$job});
}
array_push($update_array, $this->workerid, $this->expoid);
// Execute the query
$dbh = getPDOConnection();
$dbh->beginTransaction();
$stmt = $dbh->prepare($update_query);
$stmt->execute($update_array);
$dbh->commit();
return $this;
} catch (PDOException $pe) {
logMessage('JobPreference::update()', $pe->getMessage());
}
}
开发者ID:ConSked,项目名称:scheduler,代码行数:28,代码来源:JobPreference.php
示例16: deleteBulk
public static function deleteBulk($expoid, $workerid)
{
$sql = "DELETE FROM invitation WHERE expirationDate < CURRENT_DATE ";
$params = array();
if (!is_null($expoid)) {
$sql .= " OR (expoid = ? ";
$params[] = $expoid;
if (!is_null($workerid)) {
$sql .= " AND workerid = ? ";
$params[] = $workerid;
}
$sql .= ")";
// from (expoid ...
}
logMessage('Invitation::delete() called with ', $sql);
try {
$dbh = getPDOConnection();
$dbh->beginTransaction();
$stmt = $dbh->prepare($sql);
$stmt->execute($params);
$dbh->commit();
return;
} catch (PDOException $pe) {
logMessage('Invitation::delete()', $pe->getMessage());
}
}
开发者ID:ConSked,项目名称:scheduler,代码行数:26,代码来源:Invitation.php
示例17: Zip_Manager
}
$zip = new Zip_Manager();
$zip->open($filename);
$zip->filteredExtractTo('./');
$zip->close();
unlink($filename);
$filename = "GeoPC_ISO3166-2.csv";
$f = fopen($filename, 'rb');
if (!$f) {
exit(1);
}
$row = fgetcsv($f, null, ';');
if ($row != array('iso', 'country', 'code', 'name', 'altname')) {
exit(1);
}
$pdo = getPDOConnection($config);
$pdo->beginTransaction();
$st1 = $pdo->prepare('select id id from state a1 where a1.iso = ?');
$st2 = $pdo->prepare('select a1.id id from state a1 inner join country a2 on a1.country_id = a2.id where a2.iso = ? and translate(lower(a1.name),\'áàâãäāéèêëíìïóòôõöúùûüūÁÀÂÃÄĀÉÈÊËÍÌÏÓÒÔÕÖÚÙÛÜŪçÇ‘\',\'aaaaaaeeeeiiiooooouuuuuAAAAAAEEEEIIIOOOOOUUUUUcC\') = translate(lower(?),\'áàâãäāéèêëíìïóòôõöúùûüūÁÀÂÃÄĀÉÈÊËÍÌÏÓÒÔÕÖÚÙÛÜŪçÇ‘\',\'aaaaaaeeeeiiiooooouuuuuAAAAAAEEEEIIIOOOOOUUUUUcC\') ');
$st3 = $pdo->prepare('update state set iso = ?, name = ?, country_id = (select id from country where iso = ?) where id = ?');
$st4 = $pdo->prepare('insert into state (id, country_id, iso, name) values (nextval(\'state_id_seq\'), (select id from country where iso = ?), ?, ?)');
while ($row = fgetcsv($f, null, ';')) {
if (!$st1->execute(array($row[2]))) {
print_r($row);
print_r($pdo->errorInfo());
exit(1);
}
if ($r = $st1->fetchAll()) {
if (!$st3->execute(array(trim2($row[2]), trim2($row[3]), trim2($row[5]), trim2($row[0]), $r[0]['id']))) {
print_r($row);
print_r($pdo->errorInfo());
开发者ID:redelivre,项目名称:login-cidadao,代码行数:31,代码来源:lc_import_uf_iso.php
示例18: set_isDisabled
public static function set_isDisabled($workerid, $disabledFlag)
{
try {
$dbh = getPDOConnection();
$dbh->beginTransaction();
$stmt = $dbh->prepare("UPDATE worker SET isDisabled = ? WHERE workerid = ?");
$stmt->execute(array($disabledFlag, $workerid));
$dbh->commit();
return NULL;
} catch (PDOException $pe) {
// do NOT log password
logMessage('WorkerLogin::set_isDisabled(' . $workerid . ', ' . $disabledFlag . ')', $pe->getMessage());
}
}
开发者ID:ConSked,项目名称:scheduler,代码行数:14,代码来源:WorkerLogin.php
示例19: delete
public function delete()
{
try {
$dbh = getPDOConnection();
$dbh->beginTransaction();
$stmt = $dbh->prepare("DELETE FROM document WHERE documentid = ? AND reviewStatus = 'UNREVIEWED'");
$stmt->execute(array($this->documentid));
$dbh->commit();
return NULL;
} catch (PDOException $pe) {
logMessage('Document::delete()', $pe->getMessage());
}
}
开发者ID:ConSked,项目名称:scheduler,代码行数:13,代码来源:Document.php
示例20: session_start
}
session_start();
try {
include_once dirname(__FILE__) . "/../scripts-generic/servers.php";
include_once dirname(__FILE__) . "/../scripts-generic/getPDO.php";
include_once dirname(__FILE__) . "/../scripts-generic/PDOQuery.php";
include_once dirname(__FILE__) . "/../scripts-generic/checkAdmin.php";
include_once dirname(__FILE__) . "/config/translation_report.php";
$isMainAdmin = checkMainAdmin();
if ($_GET["serverid"] == "" or $_GET["serverid"] == "-1") {
$server = NULL;
} else {
$server = GetServers()[$_GET["serverid"]];
}
$lang = getReportTranslation($_GET["lang"]);
$pdo = getPDOConnection();
$conditions = array();
$parameters = array();
if (isset($_GET["report_ids"]) and $_GET["report_ids"][0] != "") {
$by_report_ids = $_GET["report_ids"];
$id_count = count($by_report_ids);
if ($id_count > 1) {
$i = 0;
foreach ($by_report_ids as $id) {
if ($i < $id_count - 1) {
$where .= " r.id = :report_id{$i} OR ";
} else {
$where .= " r.id = :report_id{$i} ";
}
$parameters[":report_id{$i}"] = $id;
$i++;
开发者ID:ezpz-cz,项目名称:report-system,代码行数:31,代码来源:getGroupedReports.php
注:本文中的getPDOConnection函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论