File tree Expand file tree Collapse file tree 4 files changed +18
-12
lines changed Expand file tree Collapse file tree 4 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 3
3
4
4
class RunnableDelete extends Delete {
5
5
/**
6
+ * @param array $params
6
7
* @return int
7
8
*/
8
- public function run () {
9
+ public function run (array $ params = array () ) {
9
10
$ query = (string )$ this ;
10
- return $ this ->db ()->exec ($ query );
11
+ return $ this ->db ()->exec ($ query, $ params );
11
12
}
12
13
}
Original file line number Diff line number Diff line change @@ -18,10 +18,13 @@ public function insertRows(array $rows) {
18
18
}
19
19
20
20
/**
21
+ * @param array $params
22
+ * @return int
23
+ * @throws Exception
21
24
*/
22
- public function run () {
25
+ public function run (array $ params = array () ) {
23
26
$ query = $ this ->__toString ();
24
- $ this ->db ()->exec ($ query );
27
+ $ this ->db ()->exec ($ query, $ params );
25
28
return (int ) $ this ->db ()->getLastInsertId ();
26
29
}
27
30
}
Original file line number Diff line number Diff line change 3
3
4
4
class RunnableUpdate extends Update {
5
5
/**
6
+ * @param array $params
6
7
* @return int
7
8
*/
8
- public function run () {
9
+ public function run (array $ params = array () ) {
9
10
$ query = $ this ->__toString ();
10
- return $ this ->db ()->exec ($ query );
11
+ return $ this ->db ()->exec ($ query, $ params );
11
12
}
12
13
}
Original file line number Diff line number Diff line change @@ -87,17 +87,18 @@ public function prepare($query) {
87
87
* @return int
88
88
*/
89
89
public function exec ($ query , array $ params = array ()) {
90
- $ stmt = $ this ->pdo ->prepare ($ query );
91
- $ timer = microtime (true );
92
90
try {
91
+ $ stmt = $ this ->pdo ->prepare ($ query );
92
+ $ timer = microtime (true );
93
93
$ stmt ->execute ($ params );
94
+ $ this ->queryLoggers ->log ($ query , microtime (true ) - $ timer );
95
+ $ result = $ stmt ->rowCount ();
96
+ $ stmt ->closeCursor ();
97
+ return $ result ;
94
98
} catch (PDOException $ e ) {
95
99
$ this ->exceptionInterpreter ->throwMoreConcreteException ($ e );
100
+ throw $ e ;
96
101
}
97
- $ this ->queryLoggers ->log ($ query , microtime (true ) - $ timer );
98
- $ result = $ stmt ->rowCount ();
99
- $ stmt ->closeCursor ();
100
- return $ result ;
101
102
}
102
103
103
104
/**
You can’t perform that action at this time.
0 commit comments