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
8a18e986
Commit
8a18e986
authored
Nov 15, 2013
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #416 from kimhemsoe/mysqli_cleanups
Small cleanups, simplification and removed no longer needed cast
parents
2e6f3542
6fe3cabc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
13 deletions
+11
-13
MysqliStatement.php
lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
+11
-13
No files found.
lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
View file @
8a18e986
...
@@ -63,6 +63,11 @@ class MysqliStatement implements \IteratorAggregate, Statement
...
@@ -63,6 +63,11 @@ class MysqliStatement implements \IteratorAggregate, Statement
*/
*/
protected
$_bindedValues
;
protected
$_bindedValues
;
/**
* @var string
*/
protected
$types
;
/**
/**
* Contains ref values for bindValue().
* Contains ref values for bindValue().
*
*
...
@@ -91,14 +96,8 @@ class MysqliStatement implements \IteratorAggregate, Statement
...
@@ -91,14 +96,8 @@ class MysqliStatement implements \IteratorAggregate, Statement
$paramCount
=
$this
->
_stmt
->
param_count
;
$paramCount
=
$this
->
_stmt
->
param_count
;
if
(
0
<
$paramCount
)
{
if
(
0
<
$paramCount
)
{
// Index 0 is types
$this
->
types
=
str_repeat
(
's'
,
$paramCount
);
// Need to init the string else php think we are trying to access it as a array.
$this
->
_bindedValues
=
array_fill
(
1
,
$paramCount
,
null
);
$bindedValues
=
array
(
0
=>
str_repeat
(
's'
,
$paramCount
));
$null
=
null
;
for
(
$i
=
1
;
$i
<
$paramCount
;
$i
++
)
{
$bindedValues
[]
=&
$null
;
}
$this
->
_bindedValues
=
$bindedValues
;
}
}
}
}
...
@@ -118,7 +117,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
...
@@ -118,7 +117,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
}
}
$this
->
_bindedValues
[
$column
]
=&
$variable
;
$this
->
_bindedValues
[
$column
]
=&
$variable
;
$this
->
_bindedValues
[
0
]
[
$column
-
1
]
=
$type
;
$this
->
types
[
$column
-
1
]
=
$type
;
return
true
;
return
true
;
}
}
...
@@ -140,7 +139,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
...
@@ -140,7 +139,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
$this
->
_values
[
$param
]
=
$value
;
$this
->
_values
[
$param
]
=
$value
;
$this
->
_bindedValues
[
$param
]
=&
$this
->
_values
[
$param
];
$this
->
_bindedValues
[
$param
]
=&
$this
->
_values
[
$param
];
$this
->
_bindedValues
[
0
]
[
$param
-
1
]
=
$type
;
$this
->
types
[
$param
-
1
]
=
$type
;
return
true
;
return
true
;
}
}
...
@@ -156,7 +155,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
...
@@ -156,7 +155,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
throw
new
MysqliException
(
$this
->
_stmt
->
error
,
$this
->
_stmt
->
errno
);
throw
new
MysqliException
(
$this
->
_stmt
->
error
,
$this
->
_stmt
->
errno
);
}
}
}
else
{
}
else
{
if
(
!
call_user_func_array
(
array
(
$this
->
_stmt
,
'bind_param'
),
$this
->
_bindedValues
))
{
if
(
!
call_user_func_array
(
array
(
$this
->
_stmt
,
'bind_param'
),
array
(
$this
->
types
)
+
$this
->
_bindedValues
))
{
throw
new
MysqliException
(
$this
->
_stmt
->
error
,
$this
->
_stmt
->
errno
);
throw
new
MysqliException
(
$this
->
_stmt
->
error
,
$this
->
_stmt
->
errno
);
}
}
}
}
...
@@ -229,8 +228,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
...
@@ -229,8 +228,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
if
(
true
===
$ret
)
{
if
(
true
===
$ret
)
{
$values
=
array
();
$values
=
array
();
foreach
(
$this
->
_rowBindedValues
as
$v
)
{
foreach
(
$this
->
_rowBindedValues
as
$v
)
{
// Mysqli converts them to a scalar type it can fit in.
$values
[]
=
$v
;
$values
[]
=
null
===
$v
?
null
:
(
string
)
$v
;
}
}
return
$values
;
return
$values
;
}
}
...
...
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