Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
d275bed4
Commit
d275bed4
authored
Jun 10, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed sequence handling
parent
8e071b75
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
17 deletions
+21
-17
Db2.php
lib/Doctrine/Sequence/Db2.php
+8
-4
Firebird.php
lib/Doctrine/Sequence/Firebird.php
+2
-2
Mssql.php
lib/Doctrine/Sequence/Mssql.php
+1
-1
Mysql.php
lib/Doctrine/Sequence/Mysql.php
+2
-2
Oracle.php
lib/Doctrine/Sequence/Oracle.php
+3
-3
Pgsql.php
lib/Doctrine/Sequence/Pgsql.php
+3
-3
Sqlite.php
lib/Doctrine/Sequence/Sqlite.php
+2
-2
No files found.
lib/Doctrine/Sequence/Db2.php
View file @
d275bed4
...
...
@@ -43,8 +43,10 @@ class Doctrine_Sequence_Db2 extends Doctrine_Sequence
*/
public
function
lastSequenceId
(
$sequenceName
)
{
$this
->
_connect
();
$sql
=
'SELECT PREVVAL FOR '
.
$this
->
quoteIdentifier
(
$sequenceName
)
.
' AS VAL FROM SYSIBM.SYSDUMMY1'
;
$sql
=
'SELECT PREVVAL FOR '
.
$this
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$sequenceName
))
.
' AS VAL FROM SYSIBM.SYSDUMMY1'
;
$stmt
=
$this
->
query
(
$sql
);
$result
=
$stmt
->
fetchAll
(
Zend_Db
::
FETCH_ASSOC
);
if
(
$result
)
{
...
...
@@ -66,7 +68,9 @@ class Doctrine_Sequence_Db2 extends Doctrine_Sequence
public
function
nextSequenceId
(
$sequenceName
)
{
$this
->
_connect
();
$sql
=
'SELECT NEXTVAL FOR '
.
$this
->
quoteIdentifier
(
$sequenceName
)
.
' AS VAL FROM SYSIBM.SYSDUMMY1'
;
$sql
=
'SELECT NEXTVAL FOR '
.
$this
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$sequenceName
))
.
' AS VAL FROM SYSIBM.SYSDUMMY1'
;
$stmt
=
$this
->
query
(
$sql
);
$result
=
$stmt
->
fetchAll
(
Zend_Db
::
FETCH_ASSOC
);
if
(
$result
)
{
...
...
lib/Doctrine/Sequence/Firebird.php
View file @
d275bed4
...
...
@@ -42,7 +42,7 @@ class Doctrine_Sequence_Firebird extends Doctrine_Sequence
*/
public
function
nextID
(
$seqName
,
$onDemand
=
true
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getSequenceName
(
$seqName
),
true
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$query
=
'SELECT GEN_ID('
.
$sequenceName
.
', 1) as the_value FROM RDB$DATABASE'
;
try
{
...
...
@@ -88,7 +88,7 @@ class Doctrine_Sequence_Firebird extends Doctrine_Sequence
*/
public
function
currId
(
$seqName
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getSequenceName
(
$seqName
),
true
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$query
=
'SELECT GEN_ID('
.
$sequenceName
.
', 0) as the_value FROM RDB$DATABASE'
;
...
...
lib/Doctrine/Sequence/Mssql.php
View file @
d275bed4
...
...
@@ -42,7 +42,7 @@ class Doctrine_Sequence_Mssql extends Doctrine_Sequence
*/
public
function
nextId
(
$seqName
,
$ondemand
=
true
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
getSequenceName
(
$seqName
),
true
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$seqcolName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
getAttribute
(
Doctrine
::
ATTR_SEQCOL_NAME
),
true
);
...
...
lib/Doctrine/Sequence/Mysql.php
View file @
d275bed4
...
...
@@ -42,7 +42,7 @@ class Doctrine_Sequence_Mysql extends Doctrine_Sequence
*/
public
function
nextId
(
$seqName
,
$ondemand
=
true
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getSequenceName
(
$seqName
),
true
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$seqcolName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_SEQCOL_NAME
),
true
);
$query
=
'INSERT INTO '
.
$sequenceName
.
' ('
.
$seqcolName
.
') VALUES (NULL)'
;
...
...
@@ -101,7 +101,7 @@ class Doctrine_Sequence_Mysql extends Doctrine_Sequence
*/
public
function
currId
(
$seqName
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getSequenceName
(
$seqName
),
true
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$seqcolName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_SEQCOL_NAME
),
true
);
$query
=
'SELECT MAX('
.
$seqcolName
.
') FROM '
.
$sequenceName
;
...
...
lib/Doctrine/Sequence/Oracle.php
View file @
d275bed4
...
...
@@ -42,7 +42,7 @@ class Doctrine_Sequence_Oracle extends Doctrine_Sequence
*/
public
function
nextID
(
$seqName
,
$onDemand
=
true
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getSequenceName
(
$seqName
),
true
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$query
=
'SELECT '
.
$sequenceName
.
'.nextval FROM DUAL'
;
try
{
...
...
@@ -71,7 +71,7 @@ class Doctrine_Sequence_Oracle extends Doctrine_Sequence
public
function
lastInsertID
(
$table
=
null
,
$field
=
null
)
{
$seqName
=
$table
.
(
empty
(
$field
)
?
''
:
'_'
.
$field
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getSequenceName
(
$seqName
),
true
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
return
$this
->
conn
->
fetchOne
(
'SELECT '
.
$sequenceName
.
'.currval'
);
}
...
...
@@ -84,7 +84,7 @@ class Doctrine_Sequence_Oracle extends Doctrine_Sequence
*/
public
function
currID
(
$seqName
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getSequenceName
(
$seqName
),
true
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$query
=
'SELECT (last_number-1) FROM user_sequences'
;
$query
.=
' WHERE sequence_name='
.
$this
->
conn
->
quote
(
$sequenceName
,
'text'
);
$query
.=
' OR sequence_name='
.
$this
->
conn
->
quote
(
strtoupper
(
$sequenceName
),
'text'
);
...
...
lib/Doctrine/Sequence/Pgsql.php
View file @
d275bed4
...
...
@@ -42,7 +42,7 @@ class Doctrine_Sequence_Pgsql extends Doctrine_Sequence
*/
public
function
nextId
(
$seqName
,
$onDemand
=
true
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getSequenceName
(
$seqName
),
true
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$query
=
"SELECT NEXTVAL('"
.
$sequenceName
.
"')"
;
try
{
...
...
@@ -70,7 +70,7 @@ class Doctrine_Sequence_Pgsql extends Doctrine_Sequence
public
function
lastInsertId
(
$table
=
null
,
$field
=
null
)
{
$seqName
=
$table
.
(
empty
(
$field
)
?
''
:
'_'
.
$field
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getSequenceName
(
$seqName
),
true
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
return
(
int
)
$this
->
conn
->
fetchOne
(
"SELECT CURRVAL('"
.
$sequenceName
.
"')"
);
}
...
...
@@ -83,7 +83,7 @@ class Doctrine_Sequence_Pgsql extends Doctrine_Sequence
*/
public
function
currId
(
$seqName
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getSequenceName
(
$seqName
),
true
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
return
(
int
)
$this
->
conn
->
fetchOne
(
'SELECT last_value FROM '
.
$sequenceName
);
}
}
lib/Doctrine/Sequence/Sqlite.php
View file @
d275bed4
...
...
@@ -42,7 +42,7 @@ class Doctrine_Sequence_Sqlite extends Doctrine_Sequence
*/
public
function
nextId
(
$seqName
,
$onDemand
=
true
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getSequenceName
(
$seqName
),
true
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$seqcolName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_SEQCOL_NAME
),
true
);
$query
=
'INSERT INTO '
.
$sequenceName
.
' ('
.
$seqcolName
.
') VALUES (NULL)'
;
...
...
@@ -101,7 +101,7 @@ class Doctrine_Sequence_Sqlite extends Doctrine_Sequence
*/
public
function
currId
(
$seqName
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getSequenceName
(
$seqName
),
true
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$seqcolName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_SEQCOL_NAME
),
true
);
$query
=
'SELECT MAX('
.
$seqcolName
.
') FROM '
.
$sequenceName
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment