Example #1
0
 /**
  * Retrieve table options definition array for create table
  *
  * @param Varien_Db_Ddl_Table $table
  * @return array
  * @throws Zend_Db_Exception
  */
 protected function _getOptionsDefinition(Varien_Db_Ddl_Table $table)
 {
     $definition = array();
     $comment = $table->getComment();
     if (empty($comment)) {
         throw new Zend_Db_Exception('Comment for table is required and must be defined');
     }
     $definition[] = $this->quoteInto('COMMENT=?', $comment);
     $tableProps = array('type' => 'ENGINE=%s', 'checksum' => 'CHECKSUM=%d', 'auto_increment' => 'AUTO_INCREMENT=%d', 'avg_row_length' => 'AVG_ROW_LENGTH=%d', 'max_rows' => 'MAX_ROWS=%d', 'min_rows' => 'MIN_ROWS=%d', 'delay_key_write' => 'DELAY_KEY_WRITE=%d', 'row_format' => 'row_format=%s', 'charset' => 'charset=%s', 'collate' => 'COLLATE=%s');
     foreach ($tableProps as $key => $mask) {
         $v = $table->getOption($key);
         if ($v !== null) {
             $definition[] = sprintf($mask, $v);
         }
     }
     return $definition;
 }
Example #2
0
 /**
  * Retrieve table options definition array for create table
  *
  * @param Varien_Db_Ddl_Table $table
  * @return array
  */
 protected function _getOptionsDefination(Varien_Db_Ddl_Table $table)
 {
     $definition = array();
     $tableProps = array('type' => 'ENGINE=%s', 'checksum' => 'CHECKSUM=%d', 'auto_increment' => 'AUTO_INCREMENT=%d', 'avg_row_length' => 'AVG_ROW_LENGTH=%d', 'comment' => 'COMMENT=\'%s\'', 'max_rows' => 'MAX_ROWS=%d', 'min_rows' => 'MIN_ROWS=%d', 'delay_key_write' => 'DELAY_KEY_WRITE=%d', 'row_format' => 'row_format=%s', 'charset' => 'charset=%s', 'collate' => 'COLLATE=%s');
     foreach ($tableProps as $key => $mask) {
         $v = $table->getOption($key);
         if (!is_null($v)) {
             $definition[] = sprintf($mask, $v);
         }
     }
     return $definition;
 }