protected function getIndexType(Index $index)
 {
     $type = '';
     $vendorInfo = $index->getVendorInfoForType($this->getDatabaseType());
     if ($vendorInfo && $vendorInfo->getParameter('Index_type')) {
         $type = $vendorInfo->getParameter('Index_type') . ' ';
     } elseif ($index->isUnique()) {
         $type = 'UNIQUE ';
     }
     return $type;
 }
예제 #2
0
 /**
  * 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;
 }