Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sqlsrv-3259155
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
sqlsrv-3259155
Commits
800e6381
Commit
800e6381
authored
3 years ago
by
Beakerboy
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3210240
: Fatal error: Uncaught Error: Non-static method PDO::__construct()
parent
9e8e2aef
No related branches found
Branches containing commit
Tags
7.x-2.7
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sqlsrv/database.inc
+26
-6
26 additions, 6 deletions
sqlsrv/database.inc
sqlsrv/schema.inc
+7
-2
7 additions, 2 deletions
sqlsrv/schema.inc
with
33 additions
and
8 deletions
sqlsrv/database.inc
+
26
−
6
View file @
800e6381
...
...
@@ -141,8 +141,12 @@ class DatabaseConnection_sqlsrv extends DatabaseConnection {
// Initialize and prepare the connection prefix.
$this
->
setPrefix
(
isset
(
$this
->
connectionOptions
[
'prefix'
])
?
$this
->
connectionOptions
[
'prefix'
]
:
''
);
// Call PDO::__construct and PDO::setAttribute.
PDO
::
__construct
(
$dsn
,
$connection_options
[
'username'
],
$connection_options
[
'password'
],
$connection_options
[
'pdo'
]);
// Drupal 7.79 removed PDO as the parent of DatabaseConnection
if
(
VERSION
<=
7.78
)
{
PDO
::
__construct
(
$dsn
,
$connection_options
[
'username'
],
$connection_options
[
'password'
],
$connection_options
[
'pdo'
]);
}
else
{
$this
->
connection
=
new
PDO
(
$dsn
,
$connection_options
[
'username'
],
$connection_options
[
'password'
],
$connection_options
[
'pdo'
]);
}
}
/**
...
...
@@ -777,7 +781,12 @@ class DatabaseConnection_sqlsrv extends DatabaseConnection {
$rolled_back_other_active_savepoints
=
TRUE
;
}
}
\PDO
::
rollBack
();
// Drupal 7.79 removed PDO as the parent of DatabaseConnection
if
(
VERSION
<=
7.78
)
{
PDO
::
rollback
();
}
else
{
$this
->
connection
->
rollback
();
}
// Restore original transaction isolation level
if
(
$level
=
static
::
DefaultTransactionIsolationLevelInStatement
())
{
if
(
$savepoint
[
'settings'
]
->
Get_IsolationLevel
()
!=
DatabaseTransactionIsolationLevel
::
Ignore
())
{
...
...
@@ -840,7 +849,12 @@ class DatabaseConnection_sqlsrv extends DatabaseConnection {
foreach
(
$this
->
statement_cache
as
$statement
)
{
$statement
->
closeCursor
();
}
\PDO
::
beginTransaction
();
// Drupal 7.79 removed PDO as the parent of DatabaseConnection
if
(
VERSION
<=
7.78
)
{
PDO
::
beginTransaction
();
}
else
{
$this
->
connection
->
beginTransaction
();
}
}
// Store the name and settings in the stack.
$this
->
transactionLayers
[
$name
]
=
array
(
'settings'
=>
$settings
,
'active'
=>
TRUE
,
'name'
=>
$name
,
'started'
=>
$started
);
...
...
@@ -893,7 +907,13 @@ class DatabaseConnection_sqlsrv extends DatabaseConnection {
if
(
empty
(
$this
->
transactionLayers
))
{
try
{
// PDO::commit() can either return FALSE or throw an exception itself
if
(
!
PDO
::
commit
())
{
// Drupal 7.79 removed PDO as the parent of DatabaseConnection
if
(
VERSION
<=
7.78
)
{
$commit_check
=
PDO
::
commit
();
}
else
{
$commit_check
=
$this
->
connection
->
commit
();
}
if
(
!
$commit_check
)
{
throw
new
DatabaseTransactionCommitFailedException
();
}
}
...
...
@@ -1106,4 +1126,4 @@ class DatabaseStatement_sqlsrv extends DatabaseStatementBase implements Database
/**
* @} End of "ingroup database".
*/
\ No newline at end of file
*/
This diff is collapsed.
Click to expand it.
sqlsrv/schema.inc
+
7
−
2
View file @
800e6381
...
...
@@ -3,7 +3,7 @@
include_once
'fastcache.inc'
;
/**
* @file
fe
* @file
* Database schema code for Microsoft SQL Server database servers.
*/
...
...
@@ -137,7 +137,9 @@ class DatabaseSchema_sqlsrv extends DatabaseSchema {
// No worry for the tableExists() check, results
// are cached.
if
(
empty
(
$table
)
||
!
$this
->
tableExists
(
$table
))
{
// This fails with drupal > v7.78
//if (empty($table) || !$this->tableExists($table)) {
if
(
!
$this
->
tableExists
(
$table
))
{
throw
new
DatabaseSchemaObjectDoesNotExistException
(
"The table '
{
$table
}
' does not exist."
);
}
...
...
@@ -378,6 +380,9 @@ class DatabaseSchema_sqlsrv extends DatabaseSchema {
* True if the table exists, false otherwise.
*/
public
function
tableExists
(
$table
,
$reset
=
FALSE
)
{
if
(
empty
(
$table
))
{
return
FALSE
;
}
// Do not cache temporary tables (#)
if
(
!
$reset
&&
$table
[
0
]
!=
'#'
&&
$cache
=
fastcache
::
cache_get
(
$table
,
'tableExists'
))
{
return
$cache
->
data
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment