Exemple #1
0
 public function install()
 {
     if (parent::install()) {
         return parent::setInstalled();
     } else {
         return false;
     }
 }
Exemple #2
0
 public function install()
 {
     if (parent::install()) {
         // you should use this->_code to prefix your table to make sure it's unique
         $tablename = "yg_ext_" . $this->_code . "_exampletable";
         $sql = "CREATE TABLE {$tablename} (\n\t\t\t\t   id INT NOT NULL AUTO_INCREMENT,\n\t\t\t\t   title VARCHAR(100) NOT NULL,\n\t\t\t\t   author VARCHAR(40) NOT NULL,\n\t\t\t\t   creation DATE,\n\t\t\t\t   PRIMARY KEY (id)\n\t\t\t\t);";
         $dbr = sYDB()->Execute($sql);
         if ($dbr === false) {
             throw new \Exception(sYDB()->ErrorMsg());
             return false;
         }
         return parent::setInstalled();
     } else {
         return false;
     }
 }