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
d829e223
Commit
d829e223
authored
Jan 11, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed sequence module methods from main driver classes
parent
68227522
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
6 additions
and
145 deletions
+6
-145
Firebird.php
lib/Doctrine/Connection/Firebird.php
+0
-9
Mssql.php
lib/Doctrine/Connection/Mssql.php
+0
-41
Mysql.php
lib/Doctrine/Connection/Mysql.php
+0
-39
Oracle.php
lib/Doctrine/Connection/Oracle.php
+0
-23
Pgsql.php
lib/Doctrine/Connection/Pgsql.php
+0
-19
Sqlite.php
lib/Doctrine/Connection/Sqlite.php
+4
-12
UnitOfWork.php
lib/Doctrine/Connection/UnitOfWork.php
+2
-2
No files found.
lib/Doctrine/Connection/Firebird.php
View file @
d829e223
...
...
@@ -105,13 +105,4 @@ class Doctrine_Connection_Firebird extends Doctrine_Connection
}
return
$query
;
}
/**
* returns the next value in the given sequence
* @param string $sequence
* @return integer
*/
public
function
nextId
(
$sequence
)
{
return
$this
->
fetchOne
(
'SELECT UNIQUE FROM '
.
$sequence
);
}
}
lib/Doctrine/Connection/Mssql.php
View file @
d829e223
...
...
@@ -84,26 +84,6 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
}
return
'['
.
str_replace
(
']'
,
']]'
,
$identifier
)
.
']'
;
}
/**
* returns the next value in the given sequence
*
* @param string $sequence name of the sequence
* @return integer the next value in the given sequence
*/
public
function
nextId
(
$sequence
)
{
$sequenceName
=
$this
->
quoteIdentifier
(
$this
->
getSequenceName
(
$seqName
),
true
);
$seqcolName
=
$this
->
quoteIdentifier
(
$this
->
getAttribute
(
Doctrine
::
ATTR_SEQCOL_NAME
),
true
);
$query
=
'INSERT INTO '
.
$sequenceName
.
' ('
.
$seqcolName
.
') VALUES (0)'
;
$result
=
$this
->
exec
(
$query
);
$value
=
$this
->
dbh
->
lastInsertId
();
if
(
is_numeric
(
$value
))
{
$query
=
'DELETE FROM '
.
$sequenceName
.
' WHERE '
.
$seqcolName
.
' < '
.
$value
;
$result
=
$this
->
exec
(
$query
);
}
return
$value
;
}
/**
* Adds an adapter-specific LIMIT clause to the SELECT statement.
* [ borrowed from Zend Framework ]
...
...
@@ -158,25 +138,4 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
return
$query
;
}
/**
* Returns the autoincrement ID if supported or $id or fetches the current
* ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)
*
* @param string $table name of the table into which a new row was inserted
* @param string $field name of the field into which a new row was inserted
* @return integer
*/
public
function
lastInsertID
(
$table
=
null
,
$field
=
null
)
{
$server_info
=
$this
->
getServerVersion
();
if
(
is_array
(
$server_info
)
&&
!
is_null
(
$server_info
[
'major'
])
&&
$server_info
[
'major'
]
>=
8
)
{
$query
=
"SELECT SCOPE_IDENTITY()"
;
}
else
{
$query
=
"SELECT @@IDENTITY"
;
}
return
$this
->
fetchOne
(
$query
);
}
}
lib/Doctrine/Connection/Mysql.php
View file @
d829e223
...
...
@@ -101,45 +101,6 @@ class Doctrine_Connection_Mysql extends Doctrine_Connection_Common
$query
=
'SET NAMES '
.
$this
->
dbh
->
quote
(
$charset
);
$this
->
exec
(
$query
);
}
/**
* Returns the next free id of a sequence
*
* @param string $seq_name name of the sequence
* @param boolean $ondemand when true the sequence is
* automatic created, if it
* not exists
*
* TODO: on demand creation of sequence table
*
* @return integer
*/
public
function
nextId
(
$seqName
,
$ondemand
=
true
)
{
$sequenceName
=
$this
->
quoteIdentifier
(
$this
->
getSequenceName
(
$seqName
),
true
);
$seqcolName
=
$this
->
quoteIdentifier
(
$this
->
getAttribute
(
Doctrine
::
ATTR_SEQCOL_NAME
),
true
);
$query
=
'INSERT INTO '
.
$sequenceName
.
' ('
.
$seqcolName
.
') VALUES (NULL)'
;
$result
=
$this
->
exec
(
$query
);
$value
=
$this
->
dbh
->
lastInsertId
();
if
(
is_numeric
(
$value
))
{
$query
=
'DELETE FROM '
.
$sequenceName
.
' WHERE '
.
$seqcolName
.
' < '
.
$value
;
$result
=
$this
->
exec
(
$query
);
}
return
$value
;
}
/**
* Returns the current id of a sequence
*
* @param string $seq_name name of the sequence
* @return integer
*/
public
function
currId
(
$seqName
)
{
$sequenceName
=
$this
->
quoteIdentifier
(
$this
->
getSequenceName
(
$seqName
),
true
);
$seqcolName
=
$this
->
quoteIdentifier
(
$this
->
options
[
'seqcol_name'
],
true
);
$query
=
'SELECT MAX('
.
$seqcolName
.
') FROM '
.
$sequenceName
;
return
$this
->
fetchOne
(
$query
);
}
/**
* Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT
* query, except that if there is already a row in the table with the same
...
...
lib/Doctrine/Connection/Oracle.php
View file @
d829e223
...
...
@@ -103,27 +103,4 @@ class Doctrine_Connection_Oracle extends Doctrine_Connection
}
return
$query
;
}
/**
* returns the next value in the given sequence
*
* @param string $sequence name of the sequence
* @throws PDOException if something went wrong at database level
* @return integer
*/
public
function
nextId
(
$sequence
)
{
return
$this
->
fetchOne
(
'SELECT '
.
$sequence
.
'.nextval FROM dual'
);
}
/**
* Returns the current id of a sequence
*
* @param string $sequence name of the sequence
* @throws PDOException if something went wrong at database level
* @return mixed id
*/
public
function
currId
(
$sequence
)
{
$sequence
=
$this
->
quoteIdentifier
(
$this
->
getSequenceName
(
$sequence
),
true
);
return
$this
->
fetchOne
(
'SELECT '
.
$sequence
.
'.currval FROM dual'
);
}
}
lib/Doctrine/Connection/Pgsql.php
View file @
d829e223
...
...
@@ -89,25 +89,6 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common
$query
=
'SET NAMES '
.
$this
->
dbh
->
quote
(
$charset
);
$this
->
exec
(
$query
);
}
/**
* returns the next value in the given sequence
* @param string $sequence
* @return integer
*/
public
function
nextId
(
$sequence
)
{
return
$this
->
fetchOne
(
"SELECT NEXTVAL('
$sequence
')"
);
}
/**
* Returns the current id of a sequence
*
* @param string $seq_name name of the sequence
* @return integer
*/
public
function
currId
(
$sequence
)
{
return
$this
->
fetcOne
(
'SELECT last_value FROM '
.
$sequence
);
}
/**
* Changes a query string for various DBMS specific reasons
*
...
...
lib/Doctrine/Connection/Sqlite.php
View file @
d829e223
...
...
@@ -74,9 +74,13 @@ class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common
$this->options['server_version'] = '';
*/
parent
::
__construct
(
$manager
,
$adapter
);
$this
->
initFunctions
();
}
/**
* initializes database functions missing in sqlite
*
* @see Doctrine_Expression
* @return void
*/
public
function
initFunctions
()
{
...
...
@@ -85,16 +89,4 @@ class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common
$this
->
dbh
->
sqliteCreateFunction
(
'concat'
,
array
(
'Doctrine_Expression_Sqlite'
,
'concatImpl'
));
$this
->
dbh
->
sqliteCreateFunction
(
'now'
,
'time'
,
0
);
}
/**
* Returns the current id of a sequence
*
* @param string $seq_name name of the sequence
* @return integer the current id in the given sequence
*/
public
function
currId
(
$sequence
)
{
$sequence
=
$this
->
quoteIdentifier
(
$sequence
,
true
);
$seqColumn
=
$this
->
quoteIdentifier
(
$this
->
options
[
'seqcol_name'
],
true
);
return
$this
->
fetchOne
(
'SELECT MAX('
.
$seqColumn
.
') FROM '
.
$sequence
);
}
}
lib/Doctrine/Connection/UnitOfWork.php
View file @
d829e223
...
...
@@ -314,10 +314,10 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen
$table
=
$record
->
getTable
();
$keys
=
$table
->
getPrimaryKeys
();
$seq
=
$record
->
getTable
()
->
getSequenceName
();
$seq
=
$record
->
getTable
()
->
getSequenceName
();
if
(
!
empty
(
$seq
))
{
$id
=
$this
->
nextId
(
$seq
);
$id
=
$this
->
conn
->
sequence
->
nextId
(
$seq
);
$name
=
$record
->
getTable
()
->
getIdentifier
();
$array
[
$name
]
=
$id
;
}
...
...
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