Exemplo n.º 1
0
<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$hostname = $_POST['hostname'];
if (!empty($hostname)) {
    $db = new MyDB();
    $stmt = $db->prepare("insert into hosts (hostname) values (:hn)");
    $stmt->bindParam(':hn', $hostname, SQLITE3_TEXT);
    $ret = $stmt->execute();
    if (!empty($ret)) {
        $host_id = $db->lastInsertRowID();
        print "Inserted row with host_id = " . $host_id;
    }
}
Exemplo n.º 2
0
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$os = $_POST['os'];
$compiler = $_POST['compiler'];
$version = $_POST['version'];
$flags = $_POST['flags'];
$library = $_POST['library'];
$library_ver = $_POST['library_ver'];
$backend = $_POST['backend'];
$backend_ver = $_POST['backend_ver'];
if (!empty($os) and !empty($compiler) and !empty($version) and !empty($flags) and !empty($library) and !empty($library_ver) and !empty($backend) and !empty($backend_ver)) {
    $db = new MyDB();
    $stmt = $db->prepare("insert into systems \n\t\t\t\t\t\t(os, compiler, version, flags, library, library_ver, backend, backend_ver) \n\t\t\t\t\t\tvalues (:o, :c, :v, :f, :l, :lv, :b, :bv)");
    $stmt->bindParam(':o', $os, SQLITE3_TEXT);
    $stmt->bindParam(':c', $compiler, SQLITE3_TEXT);
    $stmt->bindParam(':v', $version, SQLITE3_TEXT);
    $stmt->bindParam(':f', $flags, SQLITE3_TEXT);
    $stmt->bindParam(':l', $library, SQLITE3_TEXT);
    $stmt->bindParam(':lv', $library_ver, SQLITE3_TEXT);
    $stmt->bindParam(':b', $backend, SQLITE3_TEXT);
    $stmt->bindParam(':bv', $backend_ver, SQLITE3_TEXT);
    $ret = $stmt->execute();
    if (!empty($ret)) {
        $system_id = $db->lastInsertRowID();
        print "Inserted row with system_id = " . $system_id;
    }
}
Exemplo n.º 3
0
<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$url = $_POST['url'];
$hash = $_POST['hash'];
if (!empty($url) and !empty($hash)) {
    $db = new MyDB();
    $stmt = $db->prepare("insert into sources (URL, commit_hash) values (:u, :ch)");
    $stmt->bindParam(':u', $url, SQLITE3_TEXT);
    $stmt->bindParam(':ch', $hash, SQLITE3_TEXT);
    $ret = $stmt->execute();
    if (!empty($ret)) {
        $source_id = $db->lastInsertRowID();
        print "Inserted row with source_id = " . $source_id;
    }
}
Exemplo n.º 4
0
function insert_item($title, $descr, $photos)
{
    $db = new MyDB();
    if (!$db) {
        echo $db->lastErrorMsg();
    }
    $sql = "INSERT INTO item (title, description) VALUES ('{$title}','{$descr}')";
    $ret = $db->exec($sql);
    $itemID = $db->lastInsertRowID();
    foreach ($photos as $photo) {
        $sql = "INSERT INTO photo (name, item_id) VALUES ('{$photo}','{$itemID}')";
        $ret = $db->exec($sql);
    }
    if (!$ret) {
        echo $db->lastErrorMsg();
    }
}
Exemplo n.º 5
0
<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$type = $_POST['type'];
$accl_name = $_POST['accl_name'];
$arch = $_POST['arch'];
$memory = $_POST['memory'];
$cores = $_POST['cores'];
$details = $_POST['type'];
if (!empty($type) and !empty($accl_name) and !empty($arch) and !empty($memory) and !empty($cores) and !empty($details)) {
    $db = new MyDB();
    $stmt = $db->prepare("insert into accelerators \n\t\t\t\t\t\t(type, accl_name, arch, memory, cores, details) \n\t\t\t\t\t\tvalues (:t, :an, :ar, :m, :c, :d)");
    $stmt->bindParam(':t', $type, SQLITE3_TEXT);
    $stmt->bindParam(':an', $accl_name, SQLITE3_TEXT);
    $stmt->bindParam(':ar', $arch, SQLITE3_TEXT);
    $stmt->bindParam(':m', $memory, SQLITE3_INTEGER);
    $stmt->bindParam(':c', $cores, SQLITE3_INTEGER);
    $stmt->bindParam(':d', $details, SQLITE3_TEXT);
    $ret = $stmt->execute();
    if (!empty($ret)) {
        $accl_id = $db->lastInsertRowID();
        print "Inserted row with accl_id = " . $accl_id;
    }
}