webtest directory added with first test_db
[brisk.git] / webtest / test_db.php
1 <?php
2 /*
3  *  brisk - test_db.php
4  *
5  *  Copyright (C) 2014 Matteo Nastasi
6  *                          mailto: nastasi@alternativeoutput.it 
7  *                                  matteo.nastasi@milug.org
8  *                          web: http://www.alternativeoutput.it
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * General Public License for more details. You should have received a
19  * copy of the GNU General Public License along with this program; if
20  * not, write to the Free Software Foundation, Inc, 59 Temple Place -
21  * Suite 330, Boston, MA 02111-1307, USA.
22  *
23  */
24
25 $G_base = "./";
26
27 require_once($G_base."Obj/brisk.phh");
28 require_once($G_base."Obj/dbase_${G_dbasetype}.phh");
29
30 function main() {
31     do {
32         if (($bdb = BriskDB::create()) == FALSE) {
33             printf("DB creation failed<br>\n");
34             break;
35         }
36         printf("DB creation success<br>\n");
37         if ($bdb->transaction("BEGIN") == FALSE) {
38             printf("BEGIN failed<br>\n");
39             break;
40         }
41         printf("BEGIN success<br>\n");
42
43         if ($bdb->transaction("COMMIT") == FALSE) {
44             printf("COMMIT failed<br>\n");
45             break;
46         }
47         printf("COMMIT success<br>\n");
48
49         if ($bdb->transaction("BEgIN") != FALSE) {
50             printf("BEgIN missed fail<br>\n");
51             break;
52         }
53         printf("BEgIN fail correctly<br>\n");
54     } while (FALSE);
55 }
56
57 main();
58 ?>