summaryrefslogtreecommitdiff
path: root/src/main/php/sqlite-exec.php
blob: 8df2fe00346ad14bae9006b5d9344831797fc5e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

throw new Exception("Sorry, cannot just execute from file :(");


function run( $app ){
    $lotsOfSql = file_get_contents($app->srcPath);
    if( !$lotsOfSql ) throw new Exception("fopen(\"{$app->srcPath}\")");
    $app->db = new SQLite3($app->dstPath);
    if( !$app->db ) throw new Exception("SQLite3(\"{$app->dstPath}\")");
    $db = $app->db;
    $db->enableExceptions(true);
    $st = $db->prepare($lotsOfSql);
    $st->execute();
    $st->close();
}


function main(){
    $app = (object)array(
        "srcPath" => NULL/*TODO set me*/,
        "dstPath" => NULL/*TODO set me*/,
        "srcFile" => NULL,
        "db" => NULL,
    );
    run($app);
}


main();