/** * 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(); }
/** * {@inheritDoc} */ public function getCreateSequenceSQL(Sequence $sequence) { return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) . ' INCREMENT BY ' . $sequence->getAllocationSize() . ' MINVALUE ' . $sequence->getInitialValue() . ' START ' . $sequence->getInitialValue() . $this->getSequenceCacheSQL($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 \Doctrine\DBAL\Schema\Sequence $sequence1 * @param \Doctrine\DBAL\Schema\Sequence $sequence2 * * @return boolean */ public function diffSequence(Sequence $sequence1, Sequence $sequence2) { if ($sequence1->getAllocationSize() != $sequence2->getAllocationSize()) { return true; } if ($sequence1->getInitialValue() != $sequence2->getInitialValue()) { return true; } return false; }
/** * Accept an sequence * * @param Sequence $sequence a sequence object * * @return void */ public function acceptSequence(Sequence $sequence) { $this->schemaArray['sequence'][$sequence->getName()] = array('name' => $sequence->getName(), 'allocationsize' => $sequence->getAllocationSize(), 'initialvalue' => $sequence->getInitialValue()); }