public function getAlterSequenceSQL(\Doctrine\DBAL\Schema\Sequence $sequence)
 {
     return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) . ' INCREMENT BY ' . $sequence->getAllocationSize();
 }
示例#2
0
 /**
  * Gets the SQL used to create a sequence that starts with a given value
  * and increments by the given allocation size.
  *
  * Need to specifiy minvalue, since start with is hidden in the system and MINVALUE <= START WITH.
  * Therefore we can use MINVALUE to be able to get a hint what START WITH was for later introspection
  * in {@see listSequences()}
  *
  * @param \Doctrine\DBAL\Schema\Sequence $sequence
  * @return string
  */
 public function getCreateSequenceSQL(\Doctrine\DBAL\Schema\Sequence $sequence)
 {
     return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) . ' START WITH ' . $sequence->getInitialValue() . ' MINVALUE ' . $sequence->getInitialValue() . ' INCREMENT BY ' . $sequence->getAllocationSize();
 }
示例#3
0
 /**
  * {@inheritDoc}
  */
 public function getAlterSequenceSQL(Sequence $sequence)
 {
     return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) . ' INCREMENT BY ' . $sequence->getAllocationSize() . $this->getSequenceCacheSQL($sequence);
 }
 /**
  * Drops and create a new sequence.
  *
  * @param \Doctrine\DBAL\Schema\Sequence $sequence
  *
  * @return void
  *
  * @throws \Doctrine\DBAL\ConnectionException If something fails at database level.
  */
 public function dropAndCreateSequence(Sequence $sequence)
 {
     $this->tryMethod('dropSequence', $sequence->getQuotedName($this->_platform));
     $this->createSequence($sequence);
 }
 public function testReturnsSequenceSQL()
 {
     $sequence = new Sequence('test_seq', 1, 10);
     $this->assertEquals('CREATE SEQUENCE ' . $sequence->getQuotedName($this->_platform) . ' START WITH ' . $sequence->getInitialValue() . ' INCREMENT BY ' . $sequence->getAllocationSize() . ' MINVALUE ' . $sequence->getInitialValue(), $this->_platform->getCreateSequenceSQL($sequence));
     $this->assertEquals('ALTER SEQUENCE ' . $sequence->getQuotedName($this->_platform) . ' INCREMENT BY ' . $sequence->getAllocationSize(), $this->_platform->getAlterSequenceSQL($sequence));
     $this->assertEquals('DROP SEQUENCE ' . $sequence->getName(), $this->_platform->getDropSequenceSQL($sequence));
     $this->assertEquals('DROP SEQUENCE ' . $sequence->getName(), $this->_platform->getDropSequenceSQL($sequence->getName()));
 }
 /**
  * @param Sequence $sequence
  */
 public function acceptSequence(Sequence $sequence)
 {
     $this->_sequences[] = $this->_platform->getDropSequenceSQL($sequence->getQuotedName($this->_platform));
 }
 /**
  * {@inheritDoc}
  *
  * Need to specifiy minvalue, since start with is hidden in the system and MINVALUE <= START WITH.
  * Therefore we can use MINVALUE to be able to get a hint what START WITH was for later introspection
  * in {@see listSequences()}
  */
 public function getCreateSequenceSQL(Sequence $sequence)
 {
     return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) . ' START WITH ' . $sequence->getInitialValue() . ' MINVALUE ' . $sequence->getInitialValue() . ' INCREMENT BY ' . $sequence->getAllocationSize() . $this->getSequenceCacheSQL($sequence);
 }