From 184954ff320b6d8e48ee40b878b88c7bac387a52 Mon Sep 17 00:00:00 2001 From: Gabor de Mooij Date: Sat, 25 Feb 2023 01:12:01 +0100 Subject: [PATCH] RunQuery public, move IF-statement out of columnCount(). --- RedBeanPHP/Driver/RPDO.php | 10 +++++----- testing/RedUNIT/Base/Fuse.php | 4 +++- testing/RedUNIT/Mysql/Writer.php | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/RedBeanPHP/Driver/RPDO.php b/RedBeanPHP/Driver/RPDO.php index 482109466..165a8c925 100644 --- a/RedBeanPHP/Driver/RPDO.php +++ b/RedBeanPHP/Driver/RPDO.php @@ -161,7 +161,7 @@ protected function bindParams( $statement, $bindings ) * @return mixed * @throws SQL */ - protected function runQuery( $sql, $bindings, $options = array() ) + public function runQuery( $sql, $bindings, $options = array() ) { $this->connect(); if ( $this->loggingEnabled && $this->logger ) { @@ -181,12 +181,12 @@ protected function runQuery( $sql, $bindings, $options = array() ) $statement->execute(); $this->queryCounter ++; $this->affectedRows = $statement->rowCount(); + if ( isset( $options['noFetch'] ) && $options['noFetch'] ) { + $this->resultArray = array(); + return $statement; + } if ( $statement->columnCount() ) { $fetchStyle = ( isset( $options['fetchStyle'] ) ) ? $options['fetchStyle'] : NULL; - if ( isset( $options['noFetch'] ) && $options['noFetch'] ) { - $this->resultArray = array(); - return $statement; - } if ( is_null( $fetchStyle) ) { $this->resultArray = $statement->fetchAll(); } else { diff --git a/testing/RedUNIT/Base/Fuse.php b/testing/RedUNIT/Base/Fuse.php index c36c9dda7..d6d6fde89 100644 --- a/testing/RedUNIT/Base/Fuse.php +++ b/testing/RedUNIT/Base/Fuse.php @@ -205,8 +205,10 @@ public function testFactory() /** * Make sure that beans of type book_page can be fused with * models like BookPage (beautified) as well as Book_Page (non-beautified). + * + * @return void */ - public function testBeutificationOfLinkModel() + public function testBeautificationOfLinkModel() { $page = R::dispense( 'page' ); $widget = R::dispense( 'widget' ); diff --git a/testing/RedUNIT/Mysql/Writer.php b/testing/RedUNIT/Mysql/Writer.php index 5f59740ff..5a23878ec 100644 --- a/testing/RedUNIT/Mysql/Writer.php +++ b/testing/RedUNIT/Mysql/Writer.php @@ -248,8 +248,8 @@ public function testSetGetJSON() */ public function testFunctionFilters() { - global $travis; - if ($travis) return; + if (strpos(R::getCell('select version()'), '10.3.9-MariaDB') === FALSE) + return; R::nuke(); R::bindFunc( 'read', 'location.point', 'asText' ); R::bindFunc( 'write', 'location.point', 'GeomFromText' );