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
eae259a2
Commit
eae259a2
authored
Jan 05, 2007
by
lsmith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- make more use of Doctrine internal methods
parent
d4750eef
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
31 deletions
+26
-31
Firebird.php
lib/Doctrine/Connection/Firebird.php
+3
-5
Mssql.php
lib/Doctrine/Connection/Mssql.php
+12
-5
Mysql.php
lib/Doctrine/Connection/Mysql.php
+4
-4
Oracle.php
lib/Doctrine/Connection/Oracle.php
+2
-6
Pgsql.php
lib/Doctrine/Connection/Pgsql.php
+3
-7
Sqlite.php
lib/Doctrine/Connection/Sqlite.php
+2
-4
No files found.
lib/Doctrine/Connection/Firebird.php
View file @
eae259a2
...
...
@@ -87,7 +87,7 @@ class Doctrine_Connection_Firebird extends Doctrine_Connection
public
function
setCharset
(
$charset
)
{
$query
=
'SET NAMES '
.
$this
->
dbh
->
quote
(
$charset
);
$this
->
dbh
->
query
(
$query
);
$this
->
exec
(
$query
);
}
/**
* Adds an driver-specific LIMIT clause to the query
...
...
@@ -110,10 +110,8 @@ class Doctrine_Connection_Firebird extends Doctrine_Connection
* @param string $sequence
* @return integer
*/
public
function
getNextID
(
$sequence
)
public
function
nextId
(
$sequence
)
{
$stmt
=
$this
->
query
(
'SELECT UNIQUE FROM '
.
$sequence
);
$data
=
$stmt
->
fetch
(
PDO
::
FETCH_NUM
);
return
$data
[
0
];
return
$this
->
fetchOne
(
'SELECT UNIQUE FROM '
.
$sequence
);
}
}
lib/Doctrine/Connection/Mssql.php
View file @
eae259a2
...
...
@@ -92,10 +92,17 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
*/
public
function
nextId
(
$sequence
)
{
$this
->
query
(
"INSERT INTO
$sequence
(vapor) VALUES (0)"
);
$stmt
=
$this
->
query
(
"SELECT @@IDENTITY FROM
$sequence
"
);
$data
=
$stmt
->
fetch
(
PDO
::
FETCH_NUM
);
return
$data
[
0
];
$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.
...
...
@@ -170,6 +177,6 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
$query
=
"SELECT @@IDENTITY"
;
}
return
$this
->
query
One
(
$query
);
return
$this
->
fetch
One
(
$query
);
}
}
lib/Doctrine/Connection/Mysql.php
View file @
eae259a2
...
...
@@ -99,7 +99,7 @@ class Doctrine_Connection_Mysql extends Doctrine_Connection_Common
public
function
setCharset
(
$charset
)
{
$query
=
'SET NAMES '
.
$this
->
dbh
->
quote
(
$charset
);
$this
->
dbh
->
query
(
$query
);
$this
->
exec
(
$query
);
}
/**
* Returns the next free id of a sequence
...
...
@@ -118,12 +118,12 @@ class Doctrine_Connection_Mysql extends Doctrine_Connection_Common
$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
->
dbh
->
query
(
$query
);
$result
=
$this
->
exec
(
$query
);
}
return
$value
;
}
...
...
@@ -242,6 +242,6 @@ class Doctrine_Connection_Mysql extends Doctrine_Connection_Common
}
$query
=
'REPLACE INTO '
.
$table
.
' ('
.
$query
.
') VALUES ('
.
$values
.
')'
;
return
$this
->
dbh
->
exec
(
$query
);
return
$this
->
exec
(
$query
);
}
}
lib/Doctrine/Connection/Oracle.php
View file @
eae259a2
...
...
@@ -112,9 +112,7 @@ class Doctrine_Connection_Oracle extends Doctrine_Connection
*/
public
function
nextId
(
$sequence
)
{
$stmt
=
$this
->
query
(
'SELECT '
.
$sequence
.
'.nextval FROM dual'
);
$data
=
$stmt
->
fetch
(
PDO
::
FETCH_NUM
);
return
$data
[
0
];
return
$this
->
fetchOne
(
'SELECT '
.
$sequence
.
'.nextval FROM dual'
);
}
/**
* Returns the current id of a sequence
...
...
@@ -126,8 +124,6 @@ class Doctrine_Connection_Oracle extends Doctrine_Connection
public
function
currId
(
$sequence
)
{
$sequence
=
$this
->
quoteIdentifier
(
$this
->
getSequenceName
(
$sequence
),
true
);
$stmt
=
$this
->
query
(
'SELECT '
.
$sequence
.
'.currval FROM dual'
);
$data
=
$stmt
->
fetch
(
PDO
::
FETCH_NUM
);
return
$data
[
0
];
return
$this
->
fetchOne
(
'SELECT '
.
$sequence
.
'.currval FROM dual'
);
}
}
lib/Doctrine/Connection/Pgsql.php
View file @
eae259a2
...
...
@@ -87,7 +87,7 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common
public
function
setCharset
(
$charset
)
{
$query
=
'SET NAMES '
.
$this
->
dbh
->
quote
(
$charset
);
$this
->
dbh
->
query
(
$query
);
$this
->
exec
(
$query
);
}
/**
* returns the next value in the given sequence
...
...
@@ -96,9 +96,7 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common
*/
public
function
nextId
(
$sequence
)
{
$stmt
=
$this
->
dbh
->
query
(
"SELECT NEXTVAL('
$sequence
')"
);
$data
=
$stmt
->
fetch
(
PDO
::
FETCH_NUM
);
return
$data
[
0
];
return
$this
->
fetchOne
(
"SELECT NEXTVAL('
$sequence
')"
);
}
/**
* Returns the current id of a sequence
...
...
@@ -108,9 +106,7 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common
*/
public
function
currId
(
$sequence
)
{
$stmt
=
$this
->
dbh
->
query
(
'SELECT last_value FROM '
.
$sequence
);
$data
=
$stmt
->
fetch
(
PDO
::
FETCH_NUM
);
return
$data
[
0
];
return
$this
->
fetcOne
(
'SELECT last_value FROM '
.
$sequence
);
}
/**
* Changes a query string for various DBMS specific reasons
...
...
lib/Doctrine/Connection/Sqlite.php
View file @
eae259a2
...
...
@@ -67,7 +67,7 @@ class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common
'pattern_escaping'
=>
false
,
);
/**
$this->options['base_transaction_name'] = '___php_
MDB2
_sqlite_auto_commit_off';
$this->options['base_transaction_name'] = '___php_
Doctrine
_sqlite_auto_commit_off';
$this->options['fixed_float'] = 0;
$this->options['database_path'] = '';
$this->options['database_extension'] = '';
...
...
@@ -95,8 +95,6 @@ class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common
{
$sequence
=
$this
->
quoteIdentifier
(
$sequence
,
true
);
$seqColumn
=
$this
->
quoteIdentifier
(
$this
->
options
[
'seqcol_name'
],
true
);
$stmt
=
$this
->
dbh
->
query
(
'SELECT MAX('
.
$seqColumn
.
') FROM '
.
$sequence
);
$data
=
$stmt
->
fetch
(
PDO
::
FETCH_NUM
);
return
$data
[
0
];
return
$this
->
fetchOne
(
'SELECT MAX('
.
$seqColumn
.
') FROM '
.
$sequence
);
}
}
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