Forked from Beteha/models/Model.php to standalone public library TPsoft/DBmodel,
added creator for build MODEL class, added basic tests
This commit is contained in:
28
test/test1.php
Normal file
28
test/test1.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/../src/DBmodel.php';
|
||||
|
||||
$db = new \TPsoft\DBmodel\DBmodel('mysql:host=127.0.0.1;dbname=test;charset=utf8mb4', 'test', 'test');
|
||||
|
||||
// test query
|
||||
$result = $db->query("show tables");
|
||||
print_r($result);
|
||||
|
||||
// test results
|
||||
$result = $db->getAll("show databases");
|
||||
print_r($result);
|
||||
|
||||
$result = $db->getAll("show tables");
|
||||
print_r($result);
|
||||
|
||||
$result = $db->getCol("show tables");
|
||||
print_r($result);
|
||||
|
||||
$result = $db->getTableColumns("test");
|
||||
print_r($result);
|
||||
|
||||
$result = $db->getRow("select * from test where id = 10");
|
||||
print_r($result);
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user