/** * Generate oracle block storage * * @param Table|Index $object object with vendor parameters * @param boolean $isPrimaryKey is a primary key vendor part * * @return string oracle vendor sql part */ public function generateBlockStorage($object, $isPrimaryKey = false) { $vendorSpecific = $object->getVendorInfoForType('oracle'); if ($vendorSpecific->isEmpty()) { return ''; } if ($isPrimaryKey) { $physicalParameters = "\nUSING INDEX\n"; $prefix = "PK"; } else { $physicalParameters = "\n"; $prefix = ""; } if ($vendorSpecific->hasParameter($prefix . 'PCTFree')) { $physicalParameters .= "PCTFREE " . $vendorSpecific->getParameter($prefix . 'PCTFree') . "\n"; } if ($vendorSpecific->hasParameter($prefix . 'InitTrans')) { $physicalParameters .= "INITRANS " . $vendorSpecific->getParameter($prefix . 'InitTrans') . "\n"; } if ($vendorSpecific->hasParameter($prefix . 'MinExtents') || $vendorSpecific->hasParameter($prefix . 'MaxExtents') || $vendorSpecific->hasParameter($prefix . 'PCTIncrease')) { $physicalParameters .= "STORAGE\n(\n"; if ($vendorSpecific->hasParameter($prefix . 'MinExtents')) { $physicalParameters .= " MINEXTENTS " . $vendorSpecific->getParameter($prefix . 'MinExtents') . "\n"; } if ($vendorSpecific->hasParameter($prefix . 'MaxExtents')) { $physicalParameters .= " MAXEXTENTS " . $vendorSpecific->getParameter($prefix . 'MaxExtents') . "\n"; } if ($vendorSpecific->hasParameter($prefix . 'PCTIncrease')) { $physicalParameters .= " PCTINCREASE " . $vendorSpecific->getParameter($prefix . 'PCTIncrease') . "\n"; } $physicalParameters .= ")\n"; } if ($vendorSpecific->hasParameter($prefix . 'Tablespace')) { $physicalParameters .= "TABLESPACE " . $vendorSpecific->getParameter($prefix . 'Tablespace'); } return $physicalParameters; }
protected function getTableOptions(Table $table) { $dbVI = $table->getDatabase()->getVendorInfoForType('mysql'); $tableVI = $table->getVendorInfoForType('mysql'); $vi = $dbVI->getMergedVendorInfo($tableVI); $tableOptions = array(); // List of supported table options // see http://dev.mysql.com/doc/refman/5.5/en/create-table.html $supportedOptions = array('AutoIncrement' => 'AUTO_INCREMENT', 'AvgRowLength' => 'AVG_ROW_LENGTH', 'Charset' => 'CHARACTER SET', 'Checksum' => 'CHECKSUM', 'Collate' => 'COLLATE', 'Connection' => 'CONNECTION', 'DataDirectory' => 'DATA DIRECTORY', 'Delay_key_write' => 'DELAY_KEY_WRITE', 'DelayKeyWrite' => 'DELAY_KEY_WRITE', 'IndexDirectory' => 'INDEX DIRECTORY', 'InsertMethod' => 'INSERT_METHOD', 'KeyBlockSize' => 'KEY_BLOCK_SIZE', 'MaxRows' => 'MAX_ROWS', 'MinRows' => 'MIN_ROWS', 'Pack_Keys' => 'PACK_KEYS', 'PackKeys' => 'PACK_KEYS', 'RowFormat' => 'ROW_FORMAT', 'Union' => 'UNION'); foreach ($supportedOptions as $name => $sqlName) { $parameterValue = null; if ($vi->hasParameter($name)) { $parameterValue = $vi->getParameter($name); } elseif ($vi->hasParameter($sqlName)) { $parameterValue = $vi->getParameter($sqlName); } // if we have a param value, then parse it out if (!is_null($parameterValue)) { // if the value is numeric, then there is no need for quotes $parameterValue = is_numeric($parameterValue) ? $parameterValue : $this->quote($parameterValue); $tableOptions[] = sprintf('%s=%s', $sqlName, $parameterValue); } } return $tableOptions; }
public function getResetSchemaDDL(Table $table) { $vi = $table->getVendorInfoForType('pgsql'); if ($vi->hasParameter('schema')) { return "\nSET search_path TO public;\n"; } }