コード例 #1
0
 function setUp()
 {
     parent::setUp();
     $this->db->loadModule('Manager', null, true);
     $this->fields = array('id' => array('type' => 'integer', 'unsigned' => true, 'notnull' => true, 'default' => 0), 'somename' => array('type' => 'text', 'length' => 12), 'somedescription' => array('type' => 'text', 'length' => 12), 'sex' => array('type' => 'text', 'length' => 1, 'default' => 'M'));
     if (!$this->tableExists($this->table)) {
         $this->db->manager->createTable($this->table, $this->fields);
     }
 }
コード例 #2
0
 function setUp()
 {
     parent::setUp();
     $this->db->loadModule('Manager', null, true);
     $this->fields = array('id' => array('type' => 'integer', 'unsigned' => true, 'notnull' => true, 'default' => 0), 'textfield' => array('type' => 'text', 'length' => 12), 'booleanfield' => array('type' => 'boolean'), 'decimalfield' => array('type' => 'decimal'), 'floatfield' => array('type' => 'float'), 'datefield' => array('type' => 'date'), 'timefield' => array('type' => 'time'), 'timestampfield' => array('type' => 'timestamp'));
     if (!$this->tableExists($this->table)) {
         $this->db->manager->createTable($this->table, $this->fields);
     }
 }
コード例 #3
0
 function setUp()
 {
     parent::setUp();
     $this->db->loadModule('Manager', null, true);
     $this->fields = array('id' => array('type' => 'integer', 'unsigned' => true, 'notnull' => true, 'default' => 0), 'somename' => array('type' => 'text', 'length' => 12), 'somedescription' => array('type' => 'text', 'length' => 12), 'sex' => array('type' => 'text', 'length' => 1, 'default' => 'M'));
     $options = array();
     if ('mysql' == substr($this->db->phptype, 0, 5)) {
         $options['type'] = 'innodb';
     }
     if (!$this->tableExists($this->table)) {
         $result = $this->db->manager->createTable($this->table, $this->fields, $options);
         $this->assertFalse(PEAR::isError($result), 'Error creating table');
         $this->assertEquals(MDB2_OK, $result, 'Invalid return value for createTable()');
     }
 }
コード例 #4
0
 function setUp()
 {
     parent::setUp();
     $this->db->loadModule('Reverse', null, true);
     $this->db->loadModule('Manager', null, true);
     //Table structure
     $this->fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'notnull' => 1, 'default' => 0, 'length' => 4), 'id2' => array('type' => 'integer', 'unsigned' => 1, 'notnull' => 1, 'default' => 0), 'id3' => array('type' => 'integer', 'unsigned' => 1, 'notnull' => 1, 'default' => 0), 'id4' => array('type' => 'integer', 'unsigned' => 1, 'notnull' => 1, 'default' => 0), 'somename' => array('type' => 'text', 'length' => 12), 'somedescription' => array('type' => 'text', 'length' => 12), 'sex' => array('type' => 'text', 'length' => 1, 'default' => 'M'));
     $options = array();
     if ('mysql' == substr($this->db->phptype, 0, 5)) {
         $options['type'] = 'innodb';
     }
     if (!$this->tableExists($this->table)) {
         $this->db->manager->createTable($this->table, $this->fields, $options);
     }
     //Table2 structure
     $this->fields2 = array('ext_id' => array('type' => 'integer', 'unsigned' => 1, 'notnull' => 1, 'default' => 0), 'ext_id2' => array('type' => 'integer', 'unsigned' => 1, 'notnull' => 1, 'default' => 0), 'ext_id3' => array('type' => 'integer', 'unsigned' => 1, 'notnull' => 1, 'default' => 0));
     if (!$this->tableExists($this->table2)) {
         $this->db->manager->createTable($this->table2, $this->fields2, $options);
     }
 }
コード例 #5
0
 function setUp()
 {
     parent::setUp();
     $this->db->loadModule('Function', null, true);
 }