function Run($aProjname, $aForceUpdate = false) { $this->iProjname = $aProjname; echo "<h3>Scanning files for project '{$aProjname}'</h3>"; // Find full filename of all project files in the project $proj = $this->iDBUtils->GetProject($aProjname); $projidx = $proj['fld_key']; $q = "SELECT * FROM tbl_projfiles WHERE fld_projidx={$projidx}"; $res = $this->iDB->Query($q); $n = $res->NumRows(); $ptimer = new JpgTimer(); while ($n-- > 0) { $r = $res->Fetch(); $fname = $r['fld_name']; $modtime = filemtime($fname); $dbtime = strtotime($r['fld_dbupdtime']); if ($aForceUpdate || $modtime > $dbtime) { echo "Parsing file {$fname}...\n"; flush(); $dbdriver = new DBDriver($aProjname, $fname, $this->iDB); $ptimer->Push(); $dbdriver->Run(); $t = round($ptimer->Pop() / 1000, 2); $q = "UPDATE tbl_projfiles SET fld_dbupdtime=now() WHERE fld_key=" . $r['fld_key']; $this->iDB->Query($q); echo "[{$t} s]<br>\n"; } else { echo "DB is up to date with file: '{$fname}'<br>\n"; } } echo "<p><h3>Done.</h3>"; HTMLGenerator::CloseWinButton(); }
public function testDeleteCriteria() { $this->prepareDB(true); $oDriver = DBDriver::get_instance('sqlite', array('filename' => dirname(__FILE__) . '/unittest.db')); $mRes = Person::delete('Person')->where('lastName', 'Piochet')->exec($oDriver); $mRes = Person::select('Person')->where('lastName', 'Piochet')->exec($oDriver); $this->assertEquals(0, $mRes->numRows()); }
?> <div class="panel panel-warning"> <div class="panel-heading"> <h3 class="panel-title">Empty!</h3> </div> <div class="panel-body"> No Article Found! </div> </div> <?php } break; } } else { $keyword = "%" . $_POST['myInput'] . "%"; $article = DBDriver::all("SELECT kba.title,kba.content, kba.views, kba.featuredimage, kba.permalink from kb_article kba where kba.published=1 and kba.permalink like :permalink", array(":permalink" => $keyword)); if (!empty($article)) { include "articles.php"; } else { ?> <div class="panel panel-warning"> <div class="panel-heading"> <h3 class="panel-title">Empty!</h3> </div> <div class="panel-body"> No Article Found! </div> </div> <?php } }
public function testDeleteMultiple() { $oDriver = DBDriver::get_instance('mongo'); // Clean up database Person::delete('Person')->where('firstName', 'Jerome')->exec($oDriver); $iCount = 10; for ($i = 0; $i < $iCount; $i++) { $oPerson = new Person(); $oPerson->firstName = 'Jerome'; $oPerson->lastName = 'Poichet'; $mRes = $oPerson->insert()->exec($oDriver); } $oRes = Person::select('Person')->where('firstName', 'Jerome')->exec($oDriver); $this->assertEquals($iCount, $oRes->numRows()); Person::delete('Person')->where('firstName', 'Jerome')->exec($oDriver); $oRes = Person::select('Person')->where('firstName', 'Jerome')->exec($oDriver); $this->assertEquals(0, $oRes->numRows()); }
function getDBDriver() { return DBDriver::pgsql(); }
<button type="submit" class="btn btn-primary">Save</button> <a href="<?php echo Request::base_url() . "/" . $uri[0] . "/all"; ?> " class="btn btn-default">Back</a> </div> </form> </div><!-- /.box --> </div><!--/.col (left) --> </div> </section> <?php break; case "delete": $com = DBDriver::row("SELECT `id`, `name`, `tags` FROM `categories` WHERE id=:id", array(':id' => $uri[2])); ?> <section class="content-header"> <h1> Manage Comments </h1> <ol class="breadcrumb"> <li><a href="<?php echo Request::base_url(); ?> "><i class="fa fa-dashboard"></i> Home</a></li> <li><a href="<?php echo Request::base_url() . "/" . $uri[0] . "/all"; ?> ">Comment</a></li> <li class="active">Delete</li>
<button type="submit" class="btn btn-primary">Save</button> <a href="<?php echo Request::base_url() . "/" . $uri[0] . "/all"; ?> " class="btn btn-default">Back</a> </div> </form> </div><!-- /.box --> </div><!--/.col (left) --> </div> </section> <?php break; case "delete": $user = DBDriver::row("SELECT id, `username`, `email` FROM `users` WHERE id=:id", array(':id' => $uri[2])); ?> <section class="content-header"> <h1> Manage User </h1> <ol class="breadcrumb"> <li><a href="<?php echo Request::base_url(); ?> "><i class="fa fa-dashboard"></i> Home</a></li> <li><a href="<?php echo Request::base_url() . "/" . $uri[0] . "/all"; ?> ">User</a></li> <li class="active">Delete</li>
<button type="submit" class="btn btn-primary">Save</button> <a href="<?php echo Request::base_url() . "/" . $uri[0] . "/all"; ?> " class="btn btn-default">Back</a> </div> </form> </div><!-- /.box --> </div><!--/.col (left) --> </div> </section> <?php break; case "delete": $cat = DBDriver::row("SELECT `id`, `title` FROM `kb_category` WHERE `id` =:id", array(':id' => $uri[2])); ?> <section class="content-header"> <h1> Manage Category </h1> <ol class="breadcrumb"> <li><a href="<?php echo Request::base_url(); ?> "><i class="fa fa-dashboard"></i> Home</a></li> <li><a href="<?php echo Request::base_url() . "/" . $uri[0] . "/all"; ?> ">Category</a></li> <li class="active">Delete</li>
<?php require_once '../PDF/fpdf.php'; $pdf = new FPDF(); require_once '../../config/DBOperator.php'; $db = new DBDriver(PDOConfig::getInstance()); if (isset($_GET['id'])) { $id = $_GET['id']; $query_header = 'call getBillHeader(?)'; $header = $db->set($query_header, array($id))[0]; $query_detail = 'call getBillDetail(?)'; $detail = $db->set($query_detail, array($id)); $pdf->AddPage(); $pdf->SetFont('Arial', 'B', 14); //====================================================== $pdf->SetFillColor(64, 64, 64); $pdf->SetTextColor(255, 255, 255); $pdf->SetFont('', 'B'); $pdf->Cell(190, 7, utf8_decode('Cotización'), 0, 0, 'C', true); $pdf->Ln(); $pdf->Ln(); $pdf->SetFillColor(224, 235, 255); $pdf->SetTextColor(0); $pdf->SetFont(''); $pdf->Cell(60, 7, 'Orden de compra Numero: '); $pdf->Cell(40, 7, $header['idPedido'], 0, 0, 'C'); $pdf->Ln(); $pdf->Cell(60, 7, 'Fecha: '); $pdf->Cell(40, 7, $header['fechaSolicitud'], 0, 0, 'C'); $pdf->Ln(); $pdf->Ln();
</div><!-- /.box-body --> <div class="box-footer"> <button type="submit" class="btn btn-primary">Submit</button> <button type="reset" class="btn btn-warning">Reset</button> </div> </form> </div><!-- /.box --> </div><!--/.col (left) --> </div> </section> <?php break; case "delete": $im = DBDriver::row("SELECT `id`, `name` FROM `kb_media` WHERE id=:id", array(':id' => $uri[2])); ?> <section class="content-header"> <h1> Media File </h1> <ol class="breadcrumb"> <li><a href="<?php echo Request::base_url(); ?> "><i class="fa fa-dashboard"></i> Home</a></li> <li><a href="<?php echo Request::base_url() . "/" . $uri[0] . "/all"; ?> ">Category</a></li> <li class="active">Delete</li>
<button type="submit" class="btn btn-primary">Save</button> <a href="<?php echo Request::base_url() . "/" . $uri[0] . "/all"; ?> " class="btn btn-default">Back</a> </div> </form> </div><!-- /.box --> </div><!--/.col (left) --> </div> </section> <?php break; case "delete": $post = DBDriver::row("SELECT `id`, `title` FROM `pages` WHERE id=:id", array(':id' => $uri[2])); ?> <section class="content-header"> <h1> Manage Articles </h1> <ol class="breadcrumb"> <li><a href="<?php echo Request::base_url(); ?> "><i class="fa fa-dashboard"></i> Home</a></li> <li><a href="<?php echo Request::base_url() . "/" . $uri[0] . "/all"; ?> ">Articles</a></li> <li class="active">Delete</li>
public static function disconnect() { self::$conn = null; }
<?php switch ($uri[1]) { case "add": DBDriver::execute("INSERT INTO `kb_category`(`title`, `description`, `permalink`, `dateadd`, `published`) VALUES (:title,:description,:permalink,NOW(),:published)", array(':title' => $_POST['category'], ':description' => $_POST['description'], ':permalink' => str_replace(" ", "-", strtolower($_POST['category'])), ':published' => $_POST['published'])); Response::redirect($uri[0] . "/all"); break; case "update": DBDriver::execute("UPDATE `kb_category` SET `title`=:title, `description`=:description, `permalink`=:permalink, `datemodified`=NOW(), `published`=:published WHERE id=:id", array(':title' => $_POST['category'], ':description' => $_POST['description'], ':permalink' => str_replace(" ", "-", strtolower($_POST['category'])), ':published' => $_POST['published'], ':id' => (int) $_POST['id'])); Response::redirect($uri[0] . "/all"); break; case "delete": DBDriver::execute('DELETE FROM `kb_category` WHERE `id` = :id', array(':id' => (int) $_POST['id'])); Response::redirect($uri[0] . "/all"); break; }
public function getLastId() { return $this->driver->getLastId(); }
<?php switch ($uri[1]) { case "add": DBDriver::execute("INSERT INTO `kb_article`(`title`, `permalink`, `category`, `content`, `featuredimage`, `dateadd`, `published`)" . "VALUES (:title, :permalink, :category, :content, :filename, NOW(), :publish)", array(':title' => $_POST['title'], ':permalink' => str_replace(" ", "-", strtolower($_POST['title'])), ':category' => $_POST['category'], ':content' => $_POST['editor'], ':filename' => $_POST['image'], ':publish' => $_POST['publish'])); Response::redirect($uri[0] . "/all"); break; case "update": DBDriver::execute("UPDATE kb_article SET title=:title, permalink=:permalink, content=:content, category=:category, datemodified=NOW(), featuredimage=:filename, published=:published WHERE id=:id", array(':title' => $_POST['title'], ':permalink' => str_replace(" ", "-", strtolower($_POST['title'])), ':category' => $_POST['category'], ':content' => $_POST['editor'], ':filename' => $_POST['image'], ':published' => $_POST['published'], ':id' => (int) $_POST['id'])); Response::redirect($uri[0] . "/all"); break; case "delete": DBDriver::execute('DELETE FROM posts WHERE id = :id', array(':id' => (int) $_POST['id'])); Response::redirect($uri[0] . "/all"); break; }
public function postDBQuery(DataMapper $mapper, $query, DBDriver $db) { $time = $db->getQueryTime(); $query = str_replace(array("\n", "\t"), array(" ", ""), $query); // Only log all queries in non-production if (Current::$config->get('mode') !== 'production') { $this->log($this->tmp, sprintf("%01.6f s. %s", $time, $query)); } if ($time > 0.25) { $this->log('SLOW_QUERY', sprintf("took %01.6f s. %s", $time, $query)); } }
/** * * delete user */ static function deleteUser($username) { // // use database // if (gatorconf::get('use_database')) { $db = new DBDriver(); $username = $db->escape($username); $sql = "DELETE FROM users WHERE username = '******'"; return $db->execute($sql); } // // use user_config_file // $current_users = gator::getAllUsers(); foreach ($current_users as $key => $user) { if ($user['username'] == $username) { unset($current_users[$key]); $json_config = json_encode($current_users); file_put_contents(gatorconf::get('user_config_file'), $json_config, LOCK_EX); break; } } return; }
<?php $sumcat = DBDriver::row("SELECT count(id) as total from kb_category WHERE published=1"); ?> <div class="column col-sm-2 col-xs-1 sidebar-offcanvas" id="sidebar"> <ul class="nav"> <li><a href="#" data-toggle="offcanvas" data-target="lg-menu" class="visible-xs text-center"><span class="fa fa-2x fa-bars"></span></a></li> </ul> <ul class="nav hidden-xs" id="lg-menu"> <li><a href="<?php echo Request::base_url(); ?> "><i class="fa fa-home"></i> Home</a></li> <li><a href="<?php echo Request::base_url() . "/" . $slug['category']; ?> /all"><i class="fa fa-list-alt"></i> List Category <span class="label label-success"> <?php echo $sumcat->total; ?> </span></a></li> <li><a href="<?php echo Request::base_url() . "/" . $slug['article'] . "/new"; ?> "><i class="fa fa-list-ul"></i> New Article</a></li> </ul> <!-- tiny only nav--> </div>