Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
315
Merge Requests
315
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
205c5b24
Commit
205c5b24
authored
Nov 29, 2008
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Patch
#337926
by hswong3i, Dave Reid, Damien Tournoud: forced connection with PDF:CASE_LOWER.
parent
9b391c2e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
25 deletions
+22
-25
includes/database/database.inc
includes/database/database.inc
+12
-4
includes/database/mysql/database.inc
includes/database/mysql/database.inc
+3
-7
includes/database/pgsql/database.inc
includes/database/pgsql/database.inc
+4
-11
includes/database/sqlite/database.inc
includes/database/sqlite/database.inc
+3
-3
No files found.
includes/database/database.inc
View file @
205c5b24
...
...
@@ -210,6 +210,13 @@ abstract class DatabaseConnection extends PDO {
*/
protected
$transactionClass
=
NULL
;
/**
* The name of the Statement class for this connection.
*
* @var string
*/
protected
$statementClass
=
NULL
;
/**
* The schema object for this connection.
*
...
...
@@ -219,8 +226,9 @@ abstract class DatabaseConnection extends PDO {
function
__construct
(
$dsn
,
$username
,
$password
,
$driver_options
=
array
())
{
// Fallback to DatabaseStatementBase if the driver has not specified one.
$statement_class
=
isset
(
$driver_options
[
'statement_class'
])
?
$driver_options
[
'statement_class'
]
:
'DatabaseStatementBase'
;
unset
(
$driver_options
[
'statement_class'
]);
if
(
empty
(
$this
->
statementClass
))
{
$this
->
statementClass
=
'DatabaseStatementBase'
;
}
// Because the other methods don't seem to work right.
$driver_options
[
PDO
::
ATTR_ERRMODE
]
=
PDO
::
ERRMODE_EXCEPTION
;
...
...
@@ -229,8 +237,8 @@ function __construct($dsn, $username, $password, $driver_options = array()) {
parent
::
__construct
(
$dsn
,
$username
,
$password
,
$driver_options
);
// Set a specific PDOStatement class if the driver requires that.
if
(
!
empty
(
$statement_class
)
)
{
$this
->
setAttribute
(
PDO
::
ATTR_STATEMENT_CLASS
,
array
(
$
statement_c
lass
,
array
(
$this
)));
if
(
$this
->
statementClass
!=
'PDOStatement'
)
{
$this
->
setAttribute
(
PDO
::
ATTR_STATEMENT_CLASS
,
array
(
$
this
->
statementC
lass
,
array
(
$this
)));
}
}
...
...
includes/database/mysql/database.inc
View file @
205c5b24
...
...
@@ -13,15 +13,11 @@
class
DatabaseConnection_mysql
extends
DatabaseConnection
{
protected
$transactionSupport
;
protected
$transactionSupport
=
FALSE
;
public
function
__construct
(
Array
$connection_options
=
array
())
{
$connection_options
+=
array
(
'transactions'
=>
FALSE
,
'port'
=>
3306
,
);
$this
->
transactionSupport
=
$connection_options
[
'transactions'
];
$this
->
transactionSupport
=
isset
(
$connection_options
[
'transactions'
])
?
$connection_options
[
'transactions'
]
:
FALSE
;
$connection_options
[
'port'
]
=
!
empty
(
$connection_options
[
'port'
])
?
$connection_options
[
'port'
]
:
3306
;
$dsn
=
'mysql:host='
.
$connection_options
[
'host'
]
.
';port='
.
$connection_options
[
'port'
]
.
';dbname='
.
$connection_options
[
'database'
];
parent
::
__construct
(
$dsn
,
$connection_options
[
'username'
],
$connection_options
[
'password'
],
array
(
...
...
includes/database/pgsql/database.inc
View file @
205c5b24
...
...
@@ -13,20 +13,13 @@
class
DatabaseConnection_pgsql
extends
DatabaseConnection
{
protected
$transactionSupport
;
protected
$transactionSupport
=
TRUE
;
public
function
__construct
(
Array
$connection_options
=
array
())
{
$this
->
transactionSupport
=
isset
(
$connection_options
[
'transactions'
])
?
$connection_options
[
'transactions'
]
:
TRUE
;
$connection_options
[
'port'
]
=
!
empty
(
$connection_options
[
'port'
])
?
$connection_options
[
'port'
]
:
5432
;
$connection_options
+=
array
(
'transactions'
=>
TRUE
,
);
$this
->
transactionSupport
=
$connection_options
[
'transactions'
];
$dsn
=
'pgsql:host='
.
$connection_options
[
'host'
]
.
' dbname='
.
$connection_options
[
'database'
];
if
(
!
empty
(
$connection_options
[
'port'
]))
{
$dsn
.
=
' port='
.
$connection_options
[
'port'
];
}
$dsn
=
'pgsql:host='
.
$connection_options
[
'host'
]
.
' dbname='
.
$connection_options
[
'database'
]
.
' port='
.
$connection_options
[
'port'
];
parent
::
__construct
(
$dsn
,
$connection_options
[
'username'
],
$connection_options
[
'password'
],
array
(
// Convert numeric values to strings when fetching.
PDO
::
ATTR_STRINGIFY_FETCHES
=>
TRUE
,
...
...
includes/database/sqlite/database.inc
View file @
205c5b24
...
...
@@ -27,11 +27,11 @@ class DatabaseConnection_sqlite extends DatabaseConnection {
public
function
__construct
(
Array
$connection_options
=
array
())
{
// We don't need a specific PDOStatement class here, we simulate it below.
$connection_options
[
'statement_class'
]
=
FALSE
;
$this
->
statementClass
=
'PDOStatement'
;
$this
->
transactionSupport
=
isset
(
$connection_options
[
'transactions'
])
?
$connection_options
[
'transactions'
]
:
TRUE
;
parent
::
__construct
(
'sqlite:'
.
$connection_options
[
'database'
],
''
,
''
,
array
(
$dns
=
'sqlite:'
.
$connection_options
[
'database'
];
parent
::
__construct
(
$dns
,
''
,
''
,
array
(
// Force column names to lower case.
PDO
::
ATTR_CASE
=>
PDO
::
CASE_LOWER
,
));
...
...
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