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; } }
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; }
/** * 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(); }
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()); } }
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(); } }
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()); } }
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()); } }
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; }
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()); } }
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; } }
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(); } }
$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>
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()); } }
/** * 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; } }
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()); } }
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()); } }
} $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());
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()); } }
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()); } }
} 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++;
public function delete() { try { $dbh = getPDOConnection(); $dbh->beginTransaction(); $stmt = $dbh->prepare("DELETE FROM shiftstatus WHERE shiftstatusid = ?"); $stmt->execute(array($this->shiftstatusid)); $dbh->commit(); return $this; } catch (PDOException $pe) { logMessage('ShiftStatus::delete()', $pe->getMessage()); } }
public function delete() { try { $dbh = getPDOConnection(); $dbh->beginTransaction(); // only permit delete in future $stmt = $dbh->prepare("DELETE FROM station WHERE stationid = ? AND expoid = ? AND startTime > CURRENT_TIMESTAMP"); $stmt->execute(array($this->stationid, $this->expoid)); $dbh->commit(); return $this; } catch (PDOException $pe) { logMessage('Station::delete()', $pe->getMessage()); } }
public function updateMaxHours($expoId, $maxHours) { try { $dbh = getPDOConnection(); $dbh->beginTransaction(); $stmt = $dbh->prepare("UPDATE workerexpo SET maxHours = ? WHERE expoid = ? AND workerid = ? "); $stmt->execute(array($maxHours, $expoId, $this->workerid)); $dbh->commit(); return $this; } catch (PDOException $pe) { logMessage('Worker::updateMaxHours(' . $expoId . ', ' . $maxHours . ')', $pe->getMessage()); } return; }
function updateByNsg($config) { $filename = getTempNam(); if (!file_get_contents_curl('https://nsgreg.nga.mil/NSGDOC/files/doc/Document/GENC%20Standard%20Index%20XML%20Ed2.0.zip', $filename, 'https://nsgreg.nga.mil/doc/view?i=2382')) { return false; } $zip = new Zip_Manager(); $zip->open($filename); $zip->filteredExtractTo('./', array('/^GENC Standard Index Ed2.0.xml$/')); $zip->close(); unlink($filename); $filename = realpath("./GENC Standard Index Ed2.0.xml"); $dom = new DOMDocument(); if (!$dom->load($filename)) { return false; } $dom->documentElement->removeAttributeNS('http://api.nsgreg.nga.mil/schema/genc/2.0', 'genc'); $xpath = new DOMXPath($dom); // $nodes = $xpath->query('//GENCStandardBaselineIndex/GeopoliticalEntity[encoding/char3Code][encoding/char2Code][encoding/numericCode][name]'); $nodes = $xpath->query('//GENCStandardBaselineIndex/GeopoliticalEntity'); if (!$nodes || !$nodes->length) { return false; } $pdo = getPDOConnection($config); $st1 = $pdo->prepare('select id from country where iso3 = ?'); $st2 = $pdo->prepare('update country set name = ? where id = ?'); $st3 = $pdo->prepare('insert into country (id, name, iso2, iso3, iso_num, reviewed) values (nextval(\'country_id_seq\'), ?,?,?,?, 0)'); $pdo->beginTransaction(); foreach ($nodes as $node) { $char3Code = $node->getElementsByTagName('char3Code')->item(0)->nodeValue; if (!$st1->execute(array($char3Code))) { print_r($char3Code); print_r($pdo->errorInfo()); return false; } if ($r = $st1->fetchAll()) { if (!$st2->execute(array($node->getElementsByTagName('name')->item(0)->nodeValue, $r[0]['id']))) { print_r($char3Code); print_r($pdo->errorInfo()); return false; } } else { if (!$st3->execute(array($node->getElementsByTagName('name')->item(0)->nodeValue, $node->getElementsByTagName('char2Code')->item(0)->nodeValue, $char3Code, $node->getElementsByTagName('numericCode')->item(0)->nodeValue))) { print_r($char3Code); print_r($pdo->errorInfo()); return false; } } /* * echo $node->getElementsByTagName('char3Code')->item(0)->nodeValue; echo $node->getElementsByTagName('char2Code')->item(0)->nodeValue; echo $node->getElementsByTagName('numericCode')->item(0)->nodeValue; echo $node->getElementsByTagName('name')->item(0)->nodeValue; */ } $st1->closeCursor(); $st2->closeCursor(); $st3->closeCursor(); $st1 = $pdo->prepare('select id id from state a1 where a1.iso6 = ?'); $st2 = $pdo->prepare('select a1.id id from state a1 inner join country a2 on a1.country_id = a2.id where a2.iso3 = ? and a1.name = ?'); $st3 = $pdo->prepare('update state set iso6 = ?, name = ?, country_id = (select id from country where iso3 = ?) where id = ?'); $st4 = $pdo->prepare('insert into state (id, country_id, iso6, name, reviewed) values (nextval(\'state_id_seq\'), (select id from country where iso3 = ?), ?, ?, 0)'); $xpath = new DOMXPath($dom); // $nodes = $xpath->query('//GENCStandardBaselineIndex/AdministrativeSubdivision[country][encoding/char6Code][name]'); $nodes = $xpath->query('//GENCStandardBaselineIndex/AdministrativeSubdivision'); if (!$nodes || !$nodes->length) { return false; } foreach ($nodes as $node) { $char6Code = $node->getElementsByTagName('char6Code')->item(0)->nodeValue; if (!$st1->execute(array($char6Code))) { print_r($char6Code); print_r($pdo->errorInfo()); exit(1); } if ($r = $st1->fetchAll()) { if (!$st3->execute(array($char6Code, $node->getElementsByTagName('name')->item(0)->nodeValue, $node->getElementsByTagName('country')->item(0)->nodeValue, $r[0]['id']))) { print_r($char6Code); print_r($pdo->errorInfo()); exit(1); } } else { if (!$st2->execute(array($node->getElementsByTagName('country')->item(0)->nodeValue, $node->getElementsByTagName('name')->item(0)->nodeValue))) { print_r($char6Code); print_r($pdo->errorInfo()); exit(1); } if ($r = $st2->fetchAll()) { if (!$st3->execute(array($char6Code, $node->getElementsByTagName('name')->item(0)->nodeValue, $node->getElementsByTagName('country')->item(0)->nodeValue, $r[0]['id']))) { print_r($char6Code); print_r($pdo->errorInfo()); exit(1); } } else { if (!$st4->execute(array($node->getElementsByTagName('country')->item(0)->nodeValue, $char6Code, $node->getElementsByTagName('name')->item(0)->nodeValue))) { print_r($char6Code); print_r($pdo->errorInfo()); exit(1); } } } } /* * echo $node->getElementsByTagName('country')->item(0)->nodeValue; echo $node->getElementsByTagName('char6Code')->item(0)->nodeValue; echo $node->getElementsByTagName('name')->item(0)->nodeValue; */ $pdo->commit(); return true; }
public function delete() { try { $dbh = getPDOConnection(); $dbh->beginTransaction(); // only permit delete in future $stmt = $dbh->prepare("DELETE job FROM job, station s WHERE job.jobid = ? AND job.stationid = s.stationid AND s.startTime > CURRENT_TIMESTAMP"); $stmt->execute(array($this->jobid)); $dbh->commit(); return $this; } catch (PDOException $pe) { logMessage('Job::delete()', $pe->getMessage()); } }
public function delete() { try { $dbh = getPDOConnection(); $dbh->beginTransaction(); $stmt = $dbh->prepare(SHIFTASSIGNMENT_DELETE_ID); $stmt->execute(array($this->expoid, $this->jobid, $this->workerid)); $dbh->commit(); logMessage("ShiftAssignment::delete()", "worker:{$this->workerid} - job:{$this->jobid} - station:{$this->stationid} - expo:{$this->expoid}\n"); return $this; } catch (PDOException $pe) { logMessage('ShiftAssignment::delete()', $pe->getMessage()); } }