protected function getIndexType(Index $index)
 {
     $type = '';
     $vendorInfo = $index->getVendorInfoForType($this->getDatabaseType());
     if ($vendorInfo && $vendorInfo->getParameter('Index_type')) {
         $type = $vendorInfo->getParameter('Index_type') . ' ';
     } elseif ($index->getIsUnique()) {
         $type = 'UNIQUE ';
     }
     return $type;
 }
Example #2
0
 /**
  * Generate oracle block storage
  *
  * @param Table|Index $object       object with vendor parameters
  * @param bool        $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 = "\r\nUSING INDEX\r\n";
         $prefix = "PK";
     } else {
         $physicalParameters = "\n";
         $prefix = "";
     }
     if ($vendorSpecific->hasParameter($prefix . 'PCTFree')) {
         $physicalParameters .= "PCTFREE " . $vendorSpecific->getParameter($prefix . 'PCTFree') . "\r\n";
     }
     if ($vendorSpecific->hasParameter($prefix . 'InitTrans')) {
         $physicalParameters .= "INITRANS " . $vendorSpecific->getParameter($prefix . 'InitTrans') . "\r\n";
     }
     if ($vendorSpecific->hasParameter($prefix . 'MinExtents') || $vendorSpecific->hasParameter($prefix . 'MaxExtents') || $vendorSpecific->hasParameter($prefix . 'PCTIncrease')) {
         $physicalParameters .= "STORAGE\r\n(\r\n";
         if ($vendorSpecific->hasParameter($prefix . 'MinExtents')) {
             $physicalParameters .= "\tMINEXTENTS " . $vendorSpecific->getParameter($prefix . 'MinExtents') . "\r\n";
         }
         if ($vendorSpecific->hasParameter($prefix . 'MaxExtents')) {
             $physicalParameters .= "\tMAXEXTENTS " . $vendorSpecific->getParameter($prefix . 'MaxExtents') . "\r\n";
         }
         if ($vendorSpecific->hasParameter($prefix . 'PCTIncrease')) {
             $physicalParameters .= "\tPCTINCREASE " . $vendorSpecific->getParameter($prefix . 'PCTIncrease') . "\r\n";
         }
         $physicalParameters .= ")\r\n";
     }
     if ($vendorSpecific->hasParameter($prefix . 'Tablespace')) {
         $physicalParameters .= "TABLESPACE " . $vendorSpecific->getParameter($prefix . 'Tablespace');
     }
     return $physicalParameters;
 }