Ejemplo n.º 1
0
//
// Select and join from database
//
$db->select("t1.*, t2.*")->from('test AS t1')->join('test AS t2', 't1.id = t2.id');
echo "<pre>" . $db->getSQL() . "</pre>";
$db->select("t1.*, t2.*, t3.*")->from('test AS t1')->join('test AS t2', 't1.id = t2.id')->join('test AS t3', 't1.id = t3.id');
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Select, limit and offset
//
$db->select("*")->from('test')->limit('1');
echo "<pre>" . $db->getSQL() . "</pre>";
$db->select("*")->from('test')->limit('2');
echo "<pre>" . $db->getSQL() . "</pre>";
$db->select("*")->from('test')->limit('1')->offset('2');
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Delete a single row
//
$db->delete('test', "id = 2");
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Delete all row
//
$db->delete('test');
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Drop a table
//
$db->dropTable('test');
echo "<pre>" . $db->getSQL() . "</pre>";