<?php
if (! isset($db)) {
if ($db = new PDO('sqlite:banane.db')) {
- $db->query('CREATE TABLE IF NOT EXISTS students
- (mnumber int, firstname string, lastname string, email string, password string, blackboard int DEFAULT 0, lastblackboard TIMESTAMP, PRIMARY KEY (mnumber))');
- $db->query('CREATE TABLE IF NOT EXISTS workdone
- (mnumber int, session int, manydone int, thisdone string, tstamp TIMESTAMP)');
- $db->query('CREATE TABLE IF NOT EXISTS prefs
- (key string, value string, PRIMARY KEY (key))');
- $db->query('CREATE TABLE IF NOT EXISTS sessions
- (id int NOT NULL, examples string, nexamples int, PRIMARY KEY (id))');
- $db->query('CREATE TABLE IF NOT EXISTS exams
- (id int NOT NULL, score string, PRIMARY KEY (id))');
- $db->query('CREATE TABLE IF NOT EXISTS examscore
- (mnumber int, exam int, scorestr string, tstamp TIMESTAMP)');
+ require 'dbscheme.inc';
}
}
?>
--- /dev/null
+../../include/dbscheme.inc
\ No newline at end of file
<?php
if (! isset($db)) {
- if ($db = new PDO('sqlite:banane.db')) {
- $db->query('CREATE TABLE IF NOT EXISTS students
- (mnumber int, firstname string, lastname string, email string, password string, blackboard int DEFAULT 0, lastblackboard TIMESTAMP, PRIMARY KEY (mnumber))');
- $db->query('CREATE TABLE IF NOT EXISTS workdone
- (mnumber int, session int, manydone int, thisdone string, tstamp TIMESTAMP)');
- $db->query('CREATE TABLE IF NOT EXISTS prefs
- (key string, value string, PRIMARY KEY (key))');
- $db->query('CREATE TABLE IF NOT EXISTS sessions
- (id int NOT NULL, examples string, nexamples int, PRIMARY KEY (id))');
- $db->query('CREATE TABLE IF NOT EXISTS exams
- (id int NOT NULL, score string, PRIMARY KEY (id))');
- $db->query('CREATE TABLE IF NOT EXISTS examscore
- (mnumber int, exam int, scorestr string, tstamp TIMESTAMP)');
+ if ($db = new PDO('sqlite:admin/banane.db')) {
+ require 'dbscheme.inc';
}
}
?>
--- /dev/null
+<?php
+$db->query('CREATE TABLE IF NOT EXISTS students
+ (mnumber int, firstname string, lastname string, email string, password string, blackboard int DEFAULT 0, lastblackboard TIMESTAMP, PRIMARY KEY (mnumber))');
+$db->query('CREATE TABLE IF NOT EXISTS workdone
+ (mnumber int, session int, manydone int, thisdone string, tstamp TIMESTAMP)');
+$db->query('CREATE TABLE IF NOT EXISTS prefs
+ (key string, value string, PRIMARY KEY (key))');
+$db->query('CREATE TABLE IF NOT EXISTS sessions
+ (id int NOT NULL, examples string, nexamples int, PRIMARY KEY (id))');
+$db->query('CREATE TABLE IF NOT EXISTS exams
+ (id int NOT NULL, score string, PRIMARY KEY (id))');
+$db->query('CREATE TABLE IF NOT EXISTS examscore
+ (mnumber int, exam int, scorestr string, tstamp TIMESTAMP)');
+?>
\ No newline at end of file