File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1616 public function __construct ($ dbname , $ host , $ username , $ password = '' )
1717 {
1818 $ this ->db = new PDO ('mysql:dbname= ' . $ dbname . ';host= ' . $ host , $ username , $ password );
19+ $ this ->checkAndCreateTables ();
1920 }
2021
2122 public function insertBenchmark ($ time = 5000 )
@@ -82,6 +83,19 @@ public function drawBenchmark()
8283 }
8384 }
8485
86+ private function checkAndCreateTables ()
87+ {
88+ $ sql = 'CREATE TABLE IF NOT EXISTS `members` (
89+ `id` int(11) NOT NULL AUTO_INCREMENT,
90+ `name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
91+ `number` int(11) NOT NULL,
92+ `gb` int(11) NOT NULL,
93+ PRIMARY KEY (`id`)
94+ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ' ;
95+
96+ $ this ->db ->query ($ sql );
97+ }
98+
8599 private function setCounter ($ counter )
86100 {
87101 $ this ->counter = $ counter ;
You can’t perform that action at this time.
0 commit comments