exec( "insert into PO_test (id, type_varchar, type_integer, type_decimal, type_text ) VALUES ( 1, 'Sweden', 9006405, 449.96, 'Sweden has nice girls!' )" ); $db->exec( "insert into PO_test (id, type_varchar, type_integer, type_decimal, type_text ) VALUES (2, 'Norway', 4593041, 385.19, 'Norway has brown goat cheese!' )" ); $db->exec( "insert into PO_test (id, type_varchar, type_integer, type_decimal, type_text ) VALUES (3, 'Ukraine', 47732079, 603.70, 'Ukraine has a long coastline to the black see.' )" ); $db->exec( "insert into PO_test (id, type_varchar, type_integer, type_decimal, type_text ) VALUES (4, 'Germany', 82443000, 357.02, 'Home of the lederhosen!.' )" ); } /** * Saves the schema from database to file. * * Use this method if you have changed the definition of the persistent object * and need to update the file on disk. */ public function saveSchema() { $db = ezcDbInstance::get(); $schema = new ezcDbSchema; $schema->load( $db, 'mysql-db', 'schema' ); $schema->save( dirname( __FILE__ ) . '/persistent_test_object.dba', 'php-file', 'schema' ); } /** * Loads the schema from file into the database. */ public static function setupTable() { $db = ezcDbInstance::get(); // Load schema $schema = new ezcDbSchema; $schema->load( dirname( __FILE__ ) . '/persistent_test_object.dba', 'php-file', 'schema' ); $schema->save( $db, ( $db->getName() . '-db' ) ); } public function setState( array $state ) { foreach( $state as $key => $value ) { $this->$key = $value; } } public function getState() { $result = array(); $result['id'] = $this->id; $result['decimal'] = $this->decimal; $result['varchar'] = $this->varchar; $result['integer'] = $this->integer; $result['text'] = $this->text; return $result; } } ?>