This repository was archived by the owner on Oct 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Table Tools
circlecreative edited this page Dec 16, 2014
·
4 revisions
This functions is for helping you create, alter, truncate, empty or delete table.
Using example:
O2ORM::$db->table->drop('table_name'); // single table
O2ORM::$db->table->drop(['table1','table2']); // multiple table
returns num of tables are being successfully dropped.
Using example:
O2ORM::$db->table->empty_table('table_name'); // single table
O2ORM::$db->table->empty_table(['table1','table2']); // multiple table
returns num of tables are being successfully empty.
Using example:
O2ORM::$db->table->truncates('table_name'); // single table
O2ORM::$db->table->truncates(['table1','table2']); // multiple table
returns num of tables are being successfully truncated.
These functions let you fetch table information.
Using example:
$tables = O2ORM::$db->table->lists();
foreach ($tables as $table)
{
echo $table;
}
returns list of tables in array
Sometimes it's helpful to know whether a particular table exists before running an operation on it. Returns a boolean TRUE/FALSE. Usage example:
if (O2ORM::$db->table->exists('table_name'))
{
// some code...
}
returns true or false (Boolean)
This tools gives you complete information about the table, such as: fields, primary keys, indexes and etc.
returns Table Metadata Objects