$dbc = (new DB);
$dbh = $dbc->openDB();
$dbc = (new DB);
$dbh = $dbc->openDB(DBNAME);
$dbc = (new DB);
$dbh = $dbc->openDB(DBNAME, DBUSER, DBPASS, DBPORT, DBSERVER, DBSOCKET);
$dbh will be referred to as $db
$db = (new DB)->openDB();
if($db->table_exists('table_name')) {
//run this code ...
}
$db = (new DB)->openDB();
if($db->column_exists('table_name', 'column_name')) {
//run this code ...
}
$db = (new DB)->openDB();
if($db->addColumn([table_name => column_name], type, pipe, definition, default)) {
where:
table_name : name of table where column will be added
column_name : name of column to be added
type : type of column e.g ( decimal(2,5); varchar(200), e.t.c)
pipe : FIRST | AFTER FIELDNAME (After can be replaced with a pipe e.g "|Email" means AFTER Email )
definition : field definition (e.g NOT NULL, UNIQUE)
default : field default value.
}
1970-01-01 00:00:00 as the default datetime which
still translates as zero.
$db = (new DB)->openDB();
if($db->drop(true)) {
//currently connected database dropped successfully!
}
if($db->drop('table_name', true)) {
//selected table_name of current database dropped successfully!
}
if($db->drop('table_name', 'column_name')) {
//relative column dropped successfully
}
error_exists() and error() method must be supplied
an argument of true in order to function as expected. However DBStatus::err() will still return
the last error encountered. Errors are discussed below.
DBStatus helps to keep track of last executed
sql queries and error responses.