1<?php 2 3namespace Doctrine\DBAL\Platforms; 4 5use Doctrine\DBAL\Schema\Index; 6use Doctrine\DBAL\Schema\Sequence; 7 8/** 9 * The SQLAnywhere12Platform provides the behavior, features and SQL dialect of the 10 * SAP Sybase SQL Anywhere 12 database platform. 11 * 12 * @deprecated Support for SQLAnywhere will be removed in 3.0. 13 */ 14class SQLAnywhere12Platform extends SQLAnywhere11Platform 15{ 16 /** 17 * {@inheritdoc} 18 */ 19 public function getCreateSequenceSQL(Sequence $sequence) 20 { 21 return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) . 22 ' INCREMENT BY ' . $sequence->getAllocationSize() . 23 ' START WITH ' . $sequence->getInitialValue() . 24 ' MINVALUE ' . $sequence->getInitialValue(); 25 } 26 27 /** 28 * {@inheritdoc} 29 */ 30 public function getAlterSequenceSQL(Sequence $sequence) 31 { 32 return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) . 33 ' INCREMENT BY ' . $sequence->getAllocationSize(); 34 } 35 36 /** 37 * {@inheritdoc} 38 */ 39 public function getDateTimeTzFormatString() 40 { 41 return 'Y-m-d H:i:s.uP'; 42 } 43 44 /** 45 * {@inheritdoc} 46 */ 47 public function getDateTimeTzTypeDeclarationSQL(array $column) 48 { 49 return 'TIMESTAMP WITH TIME ZONE'; 50 } 51 52 /** 53 * {@inheritdoc} 54 */ 55 public function getDropSequenceSQL($sequence) 56 { 57 if ($sequence instanceof Sequence) { 58 $sequence = $sequence->getQuotedName($this); 59 } 60 61 return 'DROP SEQUENCE ' . $sequence; 62 } 63 64 /** 65 * {@inheritdoc} 66 */ 67 public function getListSequencesSQL($database) 68 { 69 return 'SELECT sequence_name, increment_by, start_with, min_value FROM SYS.SYSSEQUENCE'; 70 } 71 72 /** 73 * {@inheritdoc} 74 */ 75 public function getSequenceNextValSQL($sequence) 76 { 77 return 'SELECT ' . $sequence . '.NEXTVAL'; 78 } 79 80 /** 81 * {@inheritdoc} 82 */ 83 public function supportsSequences() 84 { 85 return true; 86 } 87 88 /** 89 * {@inheritdoc} 90 */ 91 protected function getAdvancedIndexOptionsSQL(Index $index) 92 { 93 if (! $index->isPrimary() && $index->isUnique() && $index->hasFlag('with_nulls_not_distinct')) { 94 return ' WITH NULLS NOT DISTINCT' . parent::getAdvancedIndexOptionsSQL($index); 95 } 96 97 return parent::getAdvancedIndexOptionsSQL($index); 98 } 99 100 /** 101 * {@inheritdoc} 102 */ 103 protected function getReservedKeywordsClass() 104 { 105 return Keywords\SQLAnywhere12Keywords::class; 106 } 107 108 /** 109 * {@inheritDoc} 110 */ 111 protected function initializeDoctrineTypeMappings() 112 { 113 parent::initializeDoctrineTypeMappings(); 114 $this->doctrineTypeMapping['timestamp with time zone'] = 'datetime'; 115 } 116} 117