/** * Retriece linked database or default * * @return type */ protected static function getDatabase() { // $attribute = 'Database'; // if (!static::hasClassAttribute($attribute)) { // $database = Database::getDefault(); // if (!$database) { static::error("Database not found", debug_backtrace(), 1); } // static::setClassAttribute($attribute, $database); } // return static::getClassAttribute($attribute); }
<?php // require_once 'common.php'; // use Javanile\SchemaDB; // SchemaDB\Database::getDefault()->drop('confirm'); // 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(); //
public $integer_0 = 0; public $integer_1 = 10; public $integer_2 = self::TINYINT; public $integer_3 = self::SMALLINT; public $integer_4 = self::MEDIUMINT; public $integer_5 = self::INT; public $integer_6 = self::BIGINT; /**/ /* integer * / public $float_0 = .0; public $float_1 = 1.1; public $float_2 = 10.0; public $float_3 = self::DECIMAL; public $float_4 = self::NUMERIC; public $float_5 = self::FLOAT; public $float_6 = self::DOUBLE; public $float_7 = self::DOUBLE; /**/ /* date time */ public $datetime_0 = self::DATE; public $datetime_1 = self::DATETIME; public $datetime_2 = self::TIMESTAMP; } // Fields::drop('confirm'); // Fields::applyTable(); // $db = Database::getDefault(); // $db->dump(); // print-out debug info $db->benchmark();
<?php // use Javanile\SchemaDB\Database; // if (!Database::hasDefault()) { // require_once '../common.php'; // new Database(['host' => $host, 'dbname' => $name, 'username' => $user, 'password' => $pass, 'prefix' => 'Test_Join_']); } // Database::getDefault()->setDebug(true);
/** * * */ public function setupDatabase() { // $db = Database::getDefault(); // if (!$db->isReady()) { // echo '<h1>Setup database</h1>'; // $this->drawRefresh(); } }