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
abfa0ea0
Unverified
Commit
abfa0ea0
authored
Jul 17, 2020
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename $query in Connection::execute*() to $sql
parent
f12171a0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
34 deletions
+34
-34
QueryCacheProfile.php
lib/Doctrine/DBAL/Cache/QueryCacheProfile.php
+3
-3
Connection.php
lib/Doctrine/DBAL/Connection.php
+27
-27
MasterSlaveConnection.php
lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
+2
-2
Connection.php
lib/Doctrine/DBAL/Portability/Connection.php
+2
-2
No files found.
lib/Doctrine/DBAL/Cache/QueryCacheProfile.php
View file @
abfa0ea0
...
...
@@ -68,16 +68,16 @@ class QueryCacheProfile
/**
* Generates the real cache key from query, params, types and connection parameters.
*
* @param string $
query
* @param string $
sql
* @param mixed[] $params
* @param int[]|string[] $types
* @param mixed[] $connectionParams
*
* @return string[]
*/
public
function
generateCacheKeys
(
$
query
,
$params
,
$types
,
array
$connectionParams
=
[])
public
function
generateCacheKeys
(
$
sql
,
$params
,
$types
,
array
$connectionParams
=
[])
{
$realCacheKey
=
'query='
.
$
query
.
$realCacheKey
=
'query='
.
$
sql
.
'¶ms='
.
serialize
(
$params
)
.
'&types='
.
serialize
(
$types
)
.
'&connectionParams='
.
hash
(
'sha256'
,
serialize
(
$connectionParams
));
...
...
lib/Doctrine/DBAL/Connection.php
View file @
abfa0ea0
...
...
@@ -874,7 +874,7 @@ class Connection implements DriverConnection
* If the query is parametrized, a prepared statement is used.
* If an SQLLogger is configured, the execution is logged.
*
* @param string $
query
The SQL query to execute.
* @param string $
sql
The SQL query to execute.
* @param mixed[] $params The parameters to bind to the query, if any.
* @param int[]|string[] $types The types the previous parameters are in.
* @param QueryCacheProfile|null $qcp The query cache profile, optional.
...
...
@@ -883,24 +883,24 @@ class Connection implements DriverConnection
*
* @throws DBALException
*/
public
function
executeQuery
(
$
query
,
array
$params
=
[],
$types
=
[],
?
QueryCacheProfile
$qcp
=
null
)
public
function
executeQuery
(
$
sql
,
array
$params
=
[],
$types
=
[],
?
QueryCacheProfile
$qcp
=
null
)
{
if
(
$qcp
!==
null
)
{
return
$this
->
executeCacheQuery
(
$
query
,
$params
,
$types
,
$qcp
);
return
$this
->
executeCacheQuery
(
$
sql
,
$params
,
$types
,
$qcp
);
}
$connection
=
$this
->
getWrappedConnection
();
$logger
=
$this
->
_config
->
getSQLLogger
();
if
(
$logger
)
{
$logger
->
startQuery
(
$
query
,
$params
,
$types
);
$logger
->
startQuery
(
$
sql
,
$params
,
$types
);
}
try
{
if
(
$params
)
{
[
$
query
,
$params
,
$types
]
=
SQLParserUtils
::
expandListParameters
(
$query
,
$params
,
$types
);
[
$
sql
,
$params
,
$types
]
=
SQLParserUtils
::
expandListParameters
(
$sql
,
$params
,
$types
);
$stmt
=
$connection
->
prepare
(
$
query
);
$stmt
=
$connection
->
prepare
(
$
sql
);
if
(
$types
)
{
$this
->
_bindTypedValues
(
$stmt
,
$params
,
$types
);
$stmt
->
execute
();
...
...
@@ -908,10 +908,10 @@ class Connection implements DriverConnection
$stmt
->
execute
(
$params
);
}
}
else
{
$stmt
=
$connection
->
query
(
$
query
);
$stmt
=
$connection
->
query
(
$
sql
);
}
}
catch
(
Throwable
$ex
)
{
throw
DBALException
::
driverExceptionDuringQuery
(
$this
->
_driver
,
$ex
,
$
query
,
$this
->
resolveParams
(
$params
,
$types
));
throw
DBALException
::
driverExceptionDuringQuery
(
$this
->
_driver
,
$ex
,
$
sql
,
$this
->
resolveParams
(
$params
,
$types
));
}
$stmt
->
setFetchMode
(
$this
->
defaultFetchMode
);
...
...
@@ -926,7 +926,7 @@ class Connection implements DriverConnection
/**
* Executes a caching query.
*
* @param string $
query
The SQL query to execute.
* @param string $
sql
The SQL query to execute.
* @param mixed[] $params The parameters to bind to the query, if any.
* @param int[]|string[] $types The types the previous parameters are in.
* @param QueryCacheProfile $qcp The query cache profile.
...
...
@@ -935,7 +935,7 @@ class Connection implements DriverConnection
*
* @throws CacheException
*/
public
function
executeCacheQuery
(
$
query
,
$params
,
$types
,
QueryCacheProfile
$qcp
)
public
function
executeCacheQuery
(
$
sql
,
$params
,
$types
,
QueryCacheProfile
$qcp
)
{
$resultCache
=
$qcp
->
getResultCacheDriver
()
??
$this
->
_config
->
getResultCacheImpl
();
...
...
@@ -946,7 +946,7 @@ class Connection implements DriverConnection
$connectionParams
=
$this
->
getParams
();
unset
(
$connectionParams
[
'platform'
]);
[
$cacheKey
,
$realKey
]
=
$qcp
->
generateCacheKeys
(
$
query
,
$params
,
$types
,
$connectionParams
);
[
$cacheKey
,
$realKey
]
=
$qcp
->
generateCacheKeys
(
$
sql
,
$params
,
$types
,
$connectionParams
);
// fetch the row pointers entry
$data
=
$resultCache
->
fetch
(
$cacheKey
);
...
...
@@ -961,7 +961,7 @@ class Connection implements DriverConnection
}
if
(
!
isset
(
$stmt
))
{
$stmt
=
new
ResultCacheStatement
(
$this
->
executeQuery
(
$
query
,
$params
,
$types
),
$resultCache
,
$cacheKey
,
$realKey
,
$qcp
->
getLifetime
());
$stmt
=
new
ResultCacheStatement
(
$this
->
executeQuery
(
$
sql
,
$params
,
$types
),
$resultCache
,
$cacheKey
,
$realKey
,
$qcp
->
getLifetime
());
}
$stmt
->
setFetchMode
(
$this
->
defaultFetchMode
);
...
...
@@ -973,7 +973,7 @@ class Connection implements DriverConnection
* Executes an, optionally parametrized, SQL query and returns the result,
* applying a given projection/transformation function on each row of the result.
*
* @param string $
query
The SQL query to execute.
* @param string $
sql
The SQL query to execute.
* @param mixed[] $params The parameters, if any.
* @param Closure $function The transformation function that is applied on each row.
* The function receives a single parameter, an array, that
...
...
@@ -981,10 +981,10 @@ class Connection implements DriverConnection
*
* @return mixed[] The projected result of the query.
*/
public
function
project
(
$
query
,
array
$params
,
Closure
$function
)
public
function
project
(
$
sql
,
array
$params
,
Closure
$function
)
{
$result
=
[];
$stmt
=
$this
->
executeQuery
(
$
query
,
$params
);
$stmt
=
$this
->
executeQuery
(
$
sql
,
$params
);
while
(
$row
=
$stmt
->
fetch
())
{
$result
[]
=
$function
(
$row
);
...
...
@@ -1034,7 +1034,7 @@ class Connection implements DriverConnection
*
* This method supports PDO binding types as well as DBAL mapping types.
*
* @param string $
query
The SQL query.
* @param string $
sql
The SQL query.
* @param array<mixed> $params The query parameters.
* @param array<int|string|null> $types The parameter types.
*
...
...
@@ -1042,20 +1042,20 @@ class Connection implements DriverConnection
*
* @throws DBALException
*/
public
function
executeUpdate
(
$
query
,
array
$params
=
[],
array
$types
=
[])
public
function
executeUpdate
(
$
sql
,
array
$params
=
[],
array
$types
=
[])
{
$connection
=
$this
->
getWrappedConnection
();
$logger
=
$this
->
_config
->
getSQLLogger
();
if
(
$logger
)
{
$logger
->
startQuery
(
$
query
,
$params
,
$types
);
$logger
->
startQuery
(
$
sql
,
$params
,
$types
);
}
try
{
if
(
$params
)
{
[
$
query
,
$params
,
$types
]
=
SQLParserUtils
::
expandListParameters
(
$query
,
$params
,
$types
);
[
$
sql
,
$params
,
$types
]
=
SQLParserUtils
::
expandListParameters
(
$sql
,
$params
,
$types
);
$stmt
=
$connection
->
prepare
(
$
query
);
$stmt
=
$connection
->
prepare
(
$
sql
);
if
(
$types
)
{
$this
->
_bindTypedValues
(
$stmt
,
$params
,
$types
);
...
...
@@ -1066,10 +1066,10 @@ class Connection implements DriverConnection
$result
=
$stmt
->
rowCount
();
}
else
{
$result
=
$connection
->
exec
(
$
query
);
$result
=
$connection
->
exec
(
$
sql
);
}
}
catch
(
Throwable
$ex
)
{
throw
DBALException
::
driverExceptionDuringQuery
(
$this
->
_driver
,
$ex
,
$
query
,
$this
->
resolveParams
(
$params
,
$types
));
throw
DBALException
::
driverExceptionDuringQuery
(
$this
->
_driver
,
$ex
,
$
sql
,
$this
->
resolveParams
(
$params
,
$types
));
}
if
(
$logger
)
{
...
...
@@ -1082,25 +1082,25 @@ class Connection implements DriverConnection
/**
* Executes an SQL statement and return the number of affected rows.
*
* @param string $s
tatement
* @param string $s
ql
*
* @return int The number of affected rows.
*
* @throws DBALException
*/
public
function
exec
(
$s
tatement
)
public
function
exec
(
$s
ql
)
{
$connection
=
$this
->
getWrappedConnection
();
$logger
=
$this
->
_config
->
getSQLLogger
();
if
(
$logger
)
{
$logger
->
startQuery
(
$s
tatement
);
$logger
->
startQuery
(
$s
ql
);
}
try
{
$result
=
$connection
->
exec
(
$s
tatement
);
$result
=
$connection
->
exec
(
$s
ql
);
}
catch
(
Throwable
$ex
)
{
throw
DBALException
::
driverExceptionDuringQuery
(
$this
->
_driver
,
$ex
,
$s
tatement
);
throw
DBALException
::
driverExceptionDuringQuery
(
$this
->
_driver
,
$ex
,
$s
ql
);
}
if
(
$logger
)
{
...
...
lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
View file @
abfa0ea0
...
...
@@ -223,11 +223,11 @@ class MasterSlaveConnection extends Connection
/**
* {@inheritDoc}
*/
public
function
executeUpdate
(
$
query
,
array
$params
=
[],
array
$types
=
[])
public
function
executeUpdate
(
$
sql
,
array
$params
=
[],
array
$types
=
[])
{
$this
->
connect
(
'master'
);
return
parent
::
executeUpdate
(
$
query
,
$params
,
$types
);
return
parent
::
executeUpdate
(
$
sql
,
$params
,
$types
);
}
/**
...
...
lib/Doctrine/DBAL/Portability/Connection.php
View file @
abfa0ea0
...
...
@@ -100,9 +100,9 @@ class Connection extends \Doctrine\DBAL\Connection
/**
* {@inheritdoc}
*/
public
function
executeQuery
(
$
query
,
array
$params
=
[],
$types
=
[],
?
QueryCacheProfile
$qcp
=
null
)
public
function
executeQuery
(
$
sql
,
array
$params
=
[],
$types
=
[],
?
QueryCacheProfile
$qcp
=
null
)
{
$stmt
=
new
Statement
(
parent
::
executeQuery
(
$
query
,
$params
,
$types
,
$qcp
),
$this
);
$stmt
=
new
Statement
(
parent
::
executeQuery
(
$
sql
,
$params
,
$types
,
$qcp
),
$this
);
$stmt
->
setFetchMode
(
$this
->
defaultFetchMode
);
return
$stmt
;
...
...
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