// class Invoice extends SchemaDB\Storable { // public $code = ''; // public $product = '<<Product>>'; } // class Product extends SchemaDB\Storable { // public $id = self::PRIMARY_KEY; // public $name = ''; // public $price = 0.0; } // $Invoice0 = new Invoice(array('code' => 'FAT1', 'product' => array('name' => 'Product No 1', 'price' => 1.3))); // $Invoice0->store(); // Invoice::dump(); // Product::dump(); // $Invoice1 = Invoice::load('FAT1'); // SchemaDB\Debug::varDump($Invoice1);
<?php // title echo '<h1>Database diff with var_dump</h1>'; // require connection parametrs require_once 'common.php'; // use Javanile\SchemaDB; // $schema = array('User' => array('userid' => $db::VARCHAR, 'username' => '', 'password' => 0), 'Article' => array('articleid' => 0, 'title' => '', 'content' => '')); // #$db->apply($schema); // Compare schema and generate SQL to update tables $diff = $db->diff($schema); // SchemaDB\Debug::varDump($diff); // $db->benchmark();
<?php // require_once 'common.php'; // use Javanile\SchemaDB; // $db->apply(array('People' => array('name' => '', 'age' => 0))); // $db->alter(array('People' => array('name' => $db::TEXT))); // remove Person table and complete items list $db->drop('People', 'confirm'); // import Persons from array-of-array $db->import('People', array(array('name' => 'Francesco', 'age' => 10), array('name' => 'Paolo', 'age' => 12), array('name' => 'Piero', 'age' => 10), array('name' => 'Antonio', 'age' => 13))); // printout table record before delete $db->dump(); // delete Person with 10 years old $Person = $db->exists('People', array('age' => 13, '@where' => "name LIKE '{Fra}%'", '@limit' => 10)); // SchemaDB\Debug::varDump($Person);