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 33
44class RunnableDelete extends Delete {
55 /**
6+ * @param array $params
67 * @return int
78 */
8- public function run () {
9+ public function run (array $ params = array () ) {
910 $ query = (string )$ this ;
10- return $ this ->db ()->exec ($ query );
11+ return $ this ->db ()->exec ($ query, $ params );
1112 }
1213}
Original file line number Diff line number Diff line change @@ -18,10 +18,13 @@ public function insertRows(array $rows) {
1818 }
1919
2020 /**
21+ * @param array $params
22+ * @return int
23+ * @throws Exception
2124 */
22- public function run () {
25+ public function run (array $ params = array () ) {
2326 $ query = $ this ->__toString ();
24- $ this ->db ()->exec ($ query );
27+ $ this ->db ()->exec ($ query, $ params );
2528 return (int ) $ this ->db ()->getLastInsertId ();
2629 }
2730}
Original file line number Diff line number Diff line change 33
44class RunnableUpdate extends Update {
55 /**
6+ * @param array $params
67 * @return int
78 */
8- public function run () {
9+ public function run (array $ params = array () ) {
910 $ query = $ this ->__toString ();
10- return $ this ->db ()->exec ($ query );
11+ return $ this ->db ()->exec ($ query, $ params );
1112 }
1213}
Original file line number Diff line number Diff line change @@ -87,17 +87,18 @@ public function prepare($query) {
8787 * @return int
8888 */
8989 public function exec ($ query , array $ params = array ()) {
90- $ stmt = $ this ->pdo ->prepare ($ query );
91- $ timer = microtime (true );
9290 try {
91+ $ stmt = $ this ->pdo ->prepare ($ query );
92+ $ timer = microtime (true );
9393 $ stmt ->execute ($ params );
94+ $ this ->queryLoggers ->log ($ query , microtime (true ) - $ timer );
95+ $ result = $ stmt ->rowCount ();
96+ $ stmt ->closeCursor ();
97+ return $ result ;
9498 } catch (PDOException $ e ) {
9599 $ this ->exceptionInterpreter ->throwMoreConcreteException ($ e );
100+ throw $ e ;
96101 }
97- $ this ->queryLoggers ->log ($ query , microtime (true ) - $ timer );
98- $ result = $ stmt ->rowCount ();
99- $ stmt ->closeCursor ();
100- return $ result ;
101102 }
102103
103104 /**
You can’t perform that action at this time.
0 commit comments