Пример #1
0
$sessie->unsetS('psa-query-results');
$titles = FALSE;
if (!$res) {
    $body->line('no further feedback');
} else {
    $table = new Table();
    $table->setClas('result');
    $table->setId('listing');
    $table->build();
    $odd = TRUE;
    foreach ($res as $item) {
        if (!$titles) {
            $tr = new Th();
            $names = array_keys(get_object_vars($item));
            foreach ($names as $title) {
                $tr->add($title);
            }
            $tr->build();
            $titles = TRUE;
        }
        $tr = new Tr();
        if ($odd) {
            $tr->setGlobalClass('even');
            $odd = FALSE;
        } else {
            $tr->setGlobalClass('odd');
            $odd = TRUE;
        }
        foreach ($item as $data) {
            // display odd characters
            $tr->add(htmlentities($data));
Пример #2
0
 $idxadd = new Link();
 $idxadd->setHref('controller.php?cmd=index_add&table=' . $req->get('table'));
 $idxadd->setName('Add index');
 $idxadd->build();
 $body->line();
 $q = "PRAGMA index_list(" . $req->get('table') . ")";
 $sql->qo($q);
 $res = $sql->fo();
 if (!$res) {
     $body->line('No indexes defined<br>');
 } else {
     $table = new Table();
     $table->setClas('result');
     $table->build();
     $th = new Th();
     $th->add('Name');
     $th->add('Unique ?');
     $th->add('Columns');
     $th->add('&nbsp;');
     $th->build();
     foreach ($res as $item) {
         if ($item->unique == 1) {
             $uniq = 'Y';
         } else {
             $uniq = 'N';
         }
         $drop = new Link();
         $drop->setHref('controller.php?cmd=drop_idx&idxname=' . $item->name . '&table=' . $req->get('table'));
         $drop->setName('[ drop ]');
         $drop->setJs(' onclick="return PSA.really_drop(\' index [' . $item->name . ']\');" ');
         $tr = new Tr();
Пример #3
0
$body->build();
include_once './inc/menubar.php';
if (!$res) {
    $body->line('no tables defined yet');
} else {
    foreach ($res as $item) {
        $body->line('<div class="schema"><h3>' . $item->name . '</h3>');
        $q_fields = "PRAGMA table_info('" . $item->name . "')";
        $sql->qo($q_fields);
        $res_fields = $sql->fo();
        $table = new Table();
        $table->setClas('result_schema');
        $table->setId('listing');
        $table->build();
        $th = new Th();
        $th->add('name');
        $th->add('type');
        $th->add('size');
        $th->add('null allowed');
        $th->add('default');
        $th->build();
        $odd = TRUE;
        foreach ($res_fields as $item_fields) {
            $pos = strpos($item_fields->type, '(');
            if (!$pos) {
                $type = $item_fields->type;
                $size = '-';
            } else {
                $type = substr($item_fields->type, 0, $pos);
                $size = substr($item_fields->type, $pos + 1, -1);
            }
Пример #4
0
 $high = $sessie->getS('bottom') + LIMIT;
 if ($high > $records) {
     $high = $records;
 }
 $body->line(' (total # of records : <b> ' . $records . '</b> -- showing <b>' . $low . '</b> till <b>' . $high . '</b>)<br />');
 $titles = FALSE;
 $table = new Table();
 $table->setClas('result');
 $table->setId('listing');
 $table->build();
 foreach ($res as $item) {
     /**/
     if (!$titles) {
         $tr = new Th();
         if (!$is_view) {
             $tr->add('edit');
             $tr->add('delete');
         }
         if (!$pk) {
             $tr->add('ROWID');
         }
         // $names = array_keys(get_object_vars($item));
         for ($i = 0; $i < sizeof($col); ++$i) {
             $tr->add($col[$i]);
         }
         $tr->build();
         $titles = TRUE;
     }
     /**/
     $tr = new Tr();
     if ($odd) {
Пример #5
0
$name->setSize(50);
$name->setMaxlength(128);
$name->setId('tblname');
$body->line('<span class="vet">Table name</span><br /> ');
$body->line($name->dump());
$create = new Link();
$create->setHref('controller.php?cmd=table_add_action');
$create->setName('<button>Create</button>');
$body->line($create->dump());
$body->line('<hr />');
$body->line('<span class="vet">Fields</span><br /> ');
$table = new Table();
$table->setClas('result');
$table->build();
$th = new Th();
$th->add('name');
$th->add('type');
$th->add('primary');
$th->add('size');
$th->add('null');
$th->add('default');
$th->build();
$colname = new Input();
$colname->setName('colname');
$colname->setSize(25);
$colname->setMaxlength(128);
$colname->setId('colname');
$coltype = new Select();
$coltype->setName('coltype');
$coltype->setSize(1);
$coltype->setId('coltype');
Пример #6
0
$submit->build();
unset($form);
$body->line('<hr />');
$psa = new PDO("sqlite:./data/base.sqlite");
$q = "SELECT * FROM queries ORDER BY datum DESC LIMIT 10";
$tps = $psa->prepare($q);
$tps->execute();
$res = $tps->fetchAll();
if (!$res) {
    $body->line('no queries found.');
} else {
    $table = new Table();
    $table->setClas('result');
    $table->build();
    $th = new Th();
    $th->add('database');
    $th->add('date - time');
    $th->add('query (click to copy in execution field)');
    $th->build();
    foreach ($res as $item) {
        $tr = new Tr();
        if ($item['fine'] == 0) {
            $tr->setGlobalClass('query_error');
            $tr->add($item['db']);
            $tr->add($item['datum']);
            $tr->add(str_repeat("&nbsp;", 2) . $item['qs']);
        } else {
            $tr->add($item['db']);
            $tr->add($item['datum']);
            $tr->add('<div class="qs">
				<a href="#"