Changeset 373 for trunk/Common/Model.php


Ignore:
Timestamp:
Jan 19, 2012, 9:43:36 PM (13 years ago)
Author:
chronos
Message:
  • Přidáno: Různé knihovny pro zpracování HTML kódu, tabulek, stránkování, zasílání emailů, aj.
  • Přidáno: Kód zpracování fronty emailů přesunut z Global do modulu EmailQueue.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Model.php

    r370 r373  
    147147  function Install()
    148148  {
     149    $this->Database->insert('SystemModel', array('Name' => $this->Name, 'Module' => $this->Module->Id));
     150    $this->Id = $this->Database->insert_id;
     151   
    149152    $Query = 'CREATE TABLE IF NOT EXISTS `'.$this->Name.'` ('.
    150153      '`Id` int(11) NOT NULL AUTO_INCREMENT,';
    151154    foreach($this->Properties as $Property)
    152155    {
     156      $this->Database->insert('SystemModelProperty', array('Name' => $Property['Name'],
     157        'Model' => $this->Id, 'Type' => $Property['Type']));
    153158      if($Property['Type'] == PropertyDateTime)
    154159        $Query .= '`'.$Property['Name'].'` DATETIME NOT NULL,';
     
    159164      else if($Property['Type'] == PropertyString)
    160165        $Query .= '`'.$Property['Name'].'` VARCHAR(255) COLLATE utf8_general_ci NOT NULL,';
    161       else if($Property['Type'] == PropertyText)
     166      else if($Property['Type'] == PropertyText8)
     167        $Query .= '`'.$Property['Name'].'` TINYTEXT COLLATE utf8_general_ci NOT NULL,';
     168      else if($Property['Type'] == PropertyText16)
    162169        $Query .= '`'.$Property['Name'].'` TEXT COLLATE utf8_general_ci NOT NULL,';
    163       else if($Property['Type'] == PropertyInteger)
     170      else if($Property['Type'] == PropertyText24)
     171        $Query .= '`'.$Property['Name'].'` MEDIUMTEXT COLLATE utf8_general_ci NOT NULL,';
     172      else if($Property['Type'] == PropertyText32)
     173        $Query .= '`'.$Property['Name'].'` LONGTEXT COLLATE utf8_general_ci NOT NULL,';
     174      else if($Property['Type'] == PropertyInteger8)
     175        $Query .= '`'.$Property['Name'].'` TINYINT(4) NOT NULL,';
     176      else if($Property['Type'] == PropertyInteger16)
     177        $Query .= '`'.$Property['Name'].'` SMALLINT(6) NOT NULL,';
     178      else if($Property['Type'] == PropertyInteger24)
     179        $Query .= '`'.$Property['Name'].'` MEDIUMINT(9) NOT NULL,';
     180      else if($Property['Type'] == PropertyInteger32)
    164181        $Query .= '`'.$Property['Name'].'` INT(11) NOT NULL,';
     182      else if($Property['Type'] == PropertyInteger64)
     183        $Query .= '`'.$Property['Name'].'` BIGINT(20) NOT NULL,';
    165184      else if($Property['Type'] == PropertyBoolean)
    166         $Query .= '`'.$Property['Name'].'` INT(11) NOT NULL,';
     185        $Query .= '`'.$Property['Name'].'` BOOLEAN NOT NULL,';
    167186      else if($Property['Type'] == PropertyFloat)
    168187        $Query .= '`'.$Property['Name'].'` FLOAT NOT NULL,';
     188      else if($Property['Type'] == PropertyDouble)
     189        $Query .= '`'.$Property['Name'].'` DOUBLE NOT NULL,';
    169190      else if($Property['Type'] == PropertyOneToMany)
    170191        $Query .= '`'.$Property['Name'].'` INT(255) NOT NULL,'.
Note: See TracChangeset for help on using the changeset viewer.