# Source for file Sequence.php

Documentation is available at Sequence.php

1. <?php
2. /*
3. * $Id: Sequence.php 1080 2007-02-10 18:17:08Z romanb $
4. *
5. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
12. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
15. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16. *
17. * This software consists of voluntary contributions made by many individuals
18. * and is licensed under the LGPL. For more information, see
19. * <http://www.phpdoctrine.com>.
20. */
21. Doctrine::autoload('Doctrine_Connection_Module');
22. /**
23. * Doctrine_Sequence
24. * The base class for sequence handling drivers.
25. *
26. * @package Doctrine
27. * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
28. * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
29. * @category Object Relational Mapping
30. * @link www.phpdoctrine.com
31. * @since 1.0
32. * @version $Revision: 1080 $
33. */
34. class Doctrine_Sequence extends Doctrine_Connection_Module
35. {
36. /**
37. * Returns the next free id of a sequence
38. *
39. * @param string $seqName name of the sequence
40. * @param bool when true missing sequences are automatic created
41. *
42. * @return integer next id in the given sequence
43. */
44. public function nextId($seqName, $ondemand = true)
45. {
46. throw new Doctrine_Sequence_Exception('method not implemented');
47. }
48. /**
49. * Returns the autoincrement ID if supported or $id or fetches the current
50. * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)
51. *
52. * @param string name of the table into which a new row was inserted
53. * @param string name of the field into which a new row was inserted
54. */
55. public function lastInsertId($table = null, $field = null)
56. {
57. throw new Doctrine_Sequence_Exception('method not implemented');
58. }
59. /**
60. * Returns the current id of a sequence
61. *
62. * @param string $seqName name of the sequence
63. *
64. * @return integer current id in the given sequence
65. */
66. public function currId($seqName)
67. {
68. $this->warnings[] = 'database does not support getting current
69. sequence value, the sequence value was incremented';
70. return $this->nextId($seqName);
71. }
72. }