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
87f9122f
Commit
87f9122f
authored
Nov 01, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated pgsql connection driver
parent
1df7817b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
3 deletions
+59
-3
Pgsql.php
lib/Doctrine/Connection/Pgsql.php
+59
-3
No files found.
lib/Doctrine/Connection/Pgsql.php
View file @
87f9122f
...
...
@@ -60,18 +60,74 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common {
'pattern_escaping'
=>
true
,
);
$this
->
options
[
'multi_query'
]
=
false
;
parent
::
__construct
(
$manager
,
$pdo
);
}
/**
* Set the charset on the current connection
*
* @param string charset
*
* @return void
*/
public
function
setCharset
(
$charset
)
{
$query
=
'SET NAMES '
.
$this
->
dbh
->
quote
(
$charset
);
$this
->
dbh
->
query
(
$query
);
}
/**
* returns the next value in the given sequence
* @param string $sequence
* @return integer
*/
public
function
getNextID
(
$sequence
)
{
$stmt
=
$this
->
query
(
"SELECT NEXTVAL('
$sequence
')"
);
public
function
nextId
(
$sequence
)
{
$stmt
=
$this
->
dbh
->
query
(
"SELECT NEXTVAL('
$sequence
')"
);
$data
=
$stmt
->
fetch
(
PDO
::
FETCH_NUM
);
return
$data
[
0
];
}
/**
* Returns the current id of a sequence
*
* @param string $seq_name name of the sequence
* @return mixed MDB2 Error Object or id
* @access public
*/
function
currId
(
$sequence
)
{
$stmt
=
$this
->
dbh
->
query
(
'SELECT last_value FROM '
.
$sequence
);
$data
=
$stmt
->
fetch
(
PDO
::
FETCH_NUM
);
return
$data
[
0
];
}
/**
* Changes a query string for various DBMS specific reasons
*
* @param string $query query to modify
* @param integer $limit limit the number of rows
* @param integer $offset start reading from given offset
* @param boolean $isManip if the query is a DML query
* @return string modified query
*/
public
function
modifyLimitQuery
(
$query
,
$limit
,
$offset
,
$isManip
=
false
)
{
if
(
$limit
>
0
)
{
$query
=
rtrim
(
$query
);
if
(
substr
(
$query
,
-
1
)
==
';'
)
{
$query
=
substr
(
$query
,
0
,
-
1
);
}
if
(
$isManip
)
{
$manip
=
preg_replace
(
'/^(DELETE FROM|UPDATE).*$/'
,
'\\1'
,
$query
);
$from
=
$match
[
2
];
$where
=
$match
[
3
];
$query
=
$manip
.
' '
.
$from
.
' WHERE ctid=(SELECT ctid FROM '
.
$from
.
' '
.
$where
.
' LIMIT '
.
$limit
.
')'
;
}
else
{
$query
.=
' LIMIT '
.
$limit
.
' OFFSET '
.
$offset
;
}
}
return
$query
;
}
/**
* Set the transacton isolation level.
*
...
...
@@ -82,7 +138,7 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common {
* SERIALIZABLE (prevents phantom reads)
* @return void
*/
function
setTransactionIsolation
(
$isolation
)
{
public
function
setTransactionIsolation
(
$isolation
)
{
switch
(
$isolation
)
{
case
'READ UNCOMMITTED'
:
case
'READ COMMITTED'
:
...
...
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