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
5e3da655
Unverified
Commit
5e3da655
authored
Jul 17, 2020
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consistent arguments of Statement::bindParam()
parent
b31ad800
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
38 additions
and
38 deletions
+38
-38
DB2Statement.php
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
+8
-8
MysqliStatement.php
lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
+4
-4
Statement.php
lib/Doctrine/DBAL/Driver/PDOSqlsrv/Statement.php
+2
-2
PDOStatement.php
lib/Doctrine/DBAL/Driver/PDOStatement.php
+3
-3
SQLAnywhereStatement.php
...Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php
+4
-4
SQLSrvStatement.php
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
+4
-4
Statement.php
lib/Doctrine/DBAL/Driver/Statement.php
+2
-2
Statement.php
lib/Doctrine/DBAL/Portability/Statement.php
+2
-2
Statement.php
lib/Doctrine/DBAL/Statement.php
+9
-9
No files found.
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
View file @
5e3da655
...
...
@@ -103,31 +103,31 @@ class DB2Statement implements IteratorAggregate, Statement
/**
* {@inheritdoc}
*/
public
function
bindParam
(
$
column
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
public
function
bindParam
(
$
param
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
{
assert
(
is_int
(
$
column
));
assert
(
is_int
(
$
param
));
switch
(
$type
)
{
case
ParameterType
::
INTEGER
:
$this
->
bind
(
$
column
,
$variable
,
DB2_PARAM_IN
,
DB2_LONG
);
$this
->
bind
(
$
param
,
$variable
,
DB2_PARAM_IN
,
DB2_LONG
);
break
;
case
ParameterType
::
LARGE_OBJECT
:
if
(
isset
(
$this
->
lobs
[
$
column
]))
{
[,
$handle
]
=
$this
->
lobs
[
$
column
];
if
(
isset
(
$this
->
lobs
[
$
param
]))
{
[,
$handle
]
=
$this
->
lobs
[
$
param
];
fclose
(
$handle
);
}
$handle
=
$this
->
createTemporaryFile
();
$path
=
stream_get_meta_data
(
$handle
)[
'uri'
];
$this
->
bind
(
$
column
,
$path
,
DB2_PARAM_FILE
,
DB2_BINARY
);
$this
->
bind
(
$
param
,
$path
,
DB2_PARAM_FILE
,
DB2_BINARY
);
$this
->
lobs
[
$
column
]
=
[
&
$variable
,
$handle
];
$this
->
lobs
[
$
param
]
=
[
&
$variable
,
$handle
];
break
;
default
:
$this
->
bind
(
$
column
,
$variable
,
DB2_PARAM_IN
,
DB2_CHAR
);
$this
->
bind
(
$
param
,
$variable
,
DB2_PARAM_IN
,
DB2_CHAR
);
break
;
}
...
...
lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
View file @
5e3da655
...
...
@@ -101,16 +101,16 @@ class MysqliStatement implements IteratorAggregate, Statement
/**
* {@inheritdoc}
*/
public
function
bindParam
(
$
column
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
public
function
bindParam
(
$
param
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
{
assert
(
is_int
(
$
column
));
assert
(
is_int
(
$
param
));
if
(
!
isset
(
self
::
$_paramTypeMap
[
$type
]))
{
throw
new
MysqliException
(
sprintf
(
"Unknown type: '%s'"
,
$type
));
}
$this
->
_bindedValues
[
$
column
]
=&
$variable
;
$this
->
types
[
$
column
-
1
]
=
self
::
$_paramTypeMap
[
$type
];
$this
->
_bindedValues
[
$
param
]
=&
$variable
;
$this
->
types
[
$
param
-
1
]
=
self
::
$_paramTypeMap
[
$type
];
return
true
;
}
...
...
lib/Doctrine/DBAL/Driver/PDOSqlsrv/Statement.php
View file @
5e3da655
...
...
@@ -14,7 +14,7 @@ class Statement extends PDOStatement
/**
* {@inheritdoc}
*/
public
function
bindParam
(
$
column
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
,
$driverOptions
=
null
)
public
function
bindParam
(
$
param
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
,
$driverOptions
=
null
)
{
if
(
(
$type
===
ParameterType
::
LARGE_OBJECT
||
$type
===
ParameterType
::
BINARY
)
...
...
@@ -23,7 +23,7 @@ class Statement extends PDOStatement
$driverOptions
=
PDO
::
SQLSRV_ENCODING_BINARY
;
}
return
parent
::
bindParam
(
$
column
,
$variable
,
$type
,
$length
,
$driverOptions
);
return
parent
::
bindParam
(
$
param
,
$variable
,
$type
,
$length
,
$driverOptions
);
}
/**
...
...
lib/Doctrine/DBAL/Driver/PDOStatement.php
View file @
5e3da655
...
...
@@ -87,7 +87,7 @@ class PDOStatement extends \PDOStatement implements Statement
}
/**
* @param mixed $
column
* @param mixed $
param
* @param mixed $variable
* @param int $type
* @param int|null $length
...
...
@@ -95,12 +95,12 @@ class PDOStatement extends \PDOStatement implements Statement
*
* @return bool
*/
public
function
bindParam
(
$
column
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
,
$driverOptions
=
null
)
public
function
bindParam
(
$
param
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
,
$driverOptions
=
null
)
{
$type
=
$this
->
convertParamType
(
$type
);
try
{
return
parent
::
bindParam
(
$
column
,
$variable
,
$type
,
...
array_slice
(
func_get_args
(),
3
));
return
parent
::
bindParam
(
$
param
,
$variable
,
$type
,
...
array_slice
(
func_get_args
(),
3
));
}
catch
(
\PDOException
$exception
)
{
throw
new
PDOException
(
$exception
);
}
...
...
lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php
View file @
5e3da655
...
...
@@ -92,9 +92,9 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
*
* @throws SQLAnywhereException
*/
public
function
bindParam
(
$
column
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
public
function
bindParam
(
$
param
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
{
assert
(
is_int
(
$
column
));
assert
(
is_int
(
$
param
));
switch
(
$type
)
{
case
ParameterType
::
INTEGER
:
...
...
@@ -116,9 +116,9 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
throw
new
SQLAnywhereException
(
'Unknown type: '
.
$type
);
}
$this
->
boundValues
[
$
column
]
=&
$variable
;
$this
->
boundValues
[
$
param
]
=&
$variable
;
if
(
!
sasql_stmt_bind_param_ex
(
$this
->
stmt
,
$
column
-
1
,
$variable
,
$type
,
$variable
===
null
))
{
if
(
!
sasql_stmt_bind_param_ex
(
$this
->
stmt
,
$
param
-
1
,
$variable
,
$type
,
$variable
===
null
))
{
throw
SQLAnywhereException
::
fromSQLAnywhereError
(
$this
->
conn
,
$this
->
stmt
);
}
...
...
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
View file @
5e3da655
...
...
@@ -167,14 +167,14 @@ class SQLSrvStatement implements IteratorAggregate, Statement
/**
* {@inheritdoc}
*/
public
function
bindParam
(
$
column
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
public
function
bindParam
(
$
param
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
{
if
(
!
is_numeric
(
$
column
))
{
if
(
!
is_numeric
(
$
param
))
{
throw
new
SQLSrvException
(
'sqlsrv does not support named parameters to queries, use question mark (?) placeholders instead.'
);
}
$this
->
variables
[
$
column
]
=&
$variable
;
$this
->
types
[
$
column
]
=
$type
;
$this
->
variables
[
$
param
]
=&
$variable
;
$this
->
types
[
$
param
]
=
$type
;
// unset the statement resource if it exists as the new one will need to be bound to the new variable
$this
->
stmt
=
null
;
...
...
lib/Doctrine/DBAL/Driver/Statement.php
View file @
5e3da655
...
...
@@ -44,7 +44,7 @@ interface Statement extends ResultStatement
* of stored procedures that return data as output parameters, and some also as input/output
* parameters that both send in data and are updated to receive it.
*
* @param int|string $
column
Parameter identifier. For a prepared statement using named placeholders,
* @param int|string $
param
Parameter identifier. For a prepared statement using named placeholders,
* this will be a parameter name of the form :name. For a prepared statement using
* question mark placeholders, this will be the 1-indexed position of the parameter.
* @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter.
...
...
@@ -56,7 +56,7 @@ interface Statement extends ResultStatement
*
* @return bool TRUE on success or FALSE on failure.
*/
public
function
bindParam
(
$
column
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
);
public
function
bindParam
(
$
param
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
);
/**
* Fetches the SQLSTATE associated with the last operation on the statement handle.
...
...
lib/Doctrine/DBAL/Portability/Statement.php
View file @
5e3da655
...
...
@@ -47,11 +47,11 @@ class Statement implements IteratorAggregate, DriverStatement
/**
* {@inheritdoc}
*/
public
function
bindParam
(
$
column
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
public
function
bindParam
(
$
param
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
{
assert
(
$this
->
stmt
instanceof
DriverStatement
);
return
$this
->
stmt
->
bindParam
(
$
column
,
$variable
,
$type
,
$length
);
return
$this
->
stmt
->
bindParam
(
$
param
,
$variable
,
$type
,
$length
);
}
/**
...
...
lib/Doctrine/DBAL/Statement.php
View file @
5e3da655
...
...
@@ -115,20 +115,20 @@ class Statement implements IteratorAggregate, DriverStatement
*
* Binding a parameter by reference does not support DBAL mapping types.
*
* @param string|int $
name
The name or position of the parameter.
* @param mixed $var
The reference to the variable to bind.
* @param int $type The PDO binding type.
* @param int|null $length Must be specified when using an OUT bind
* so that PHP allocates enough memory to hold the returned value.
* @param string|int $
param
The name or position of the parameter.
* @param mixed $var
iable
The reference to the variable to bind.
* @param int $type
The PDO binding type.
* @param int|null $length
Must be specified when using an OUT bind
*
so that PHP allocates enough memory to hold the returned value.
*
* @return bool TRUE on success, FALSE on failure.
*/
public
function
bindParam
(
$
name
,
&
$var
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
public
function
bindParam
(
$
param
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
{
$this
->
params
[
$
name
]
=
$var
;
$this
->
types
[
$
name
]
=
$type
;
$this
->
params
[
$
param
]
=
$variable
;
$this
->
types
[
$
param
]
=
$type
;
return
$this
->
stmt
->
bindParam
(
$
name
,
$var
,
$type
,
$length
);
return
$this
->
stmt
->
bindParam
(
$
param
,
$variable
,
$type
,
$length
);
}
/**
...
...
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