blob: 3887b3df48a801c007eb93b8a00f31d40d242374 (
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
31
32
33
34
35
36
37
38
39
40
41
42
|
<?php
/**
* Isis db migration tool.
*/
// Import Malete Library.
require 'contrib/malete/php/Isis.php';
// Import Spyc.
require 'contrib/spyc/spyc.php';
// Import Isis interface.
require 'interface.php';
// Autoloader.
function __autoload($class) {
require_once 'classes/' .$class. '.php';
}
// Load configuration.
$config = Spyc::YAMLLoad('config/config.yaml');
// Load database schema.
$schema = Spyc::YAMLLoad('schemas/'. $config['database'] .'.yaml');
// Setup database connection.
$implementation = $config['implementation'] .'Db';
$db = new $implementation($schema);
// Test connection.
if ($db) {
$result = $db->read(1);
$rows = $db->rows();
// Format output.
echo '<pre>';
echo "Rows: $rows\n";
print_r($result);
echo '</pre>';
}
?>
|