Settings.php
6 years ago
WordPress.php
6 years ago
WordPressDbStatement.php
6 years ago
WordPressTracker.php
6 years ago
WordPressDbStatement.php
63 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Matomo - free/libre analytics platform |
| 4 | * |
| 5 | * @link https://matomo.org |
| 6 | * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 7 | * @package matomo |
| 8 | */ |
| 9 | |
| 10 | namespace Piwik\Db\Adapter; |
| 11 | |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit; // if accessed directly |
| 14 | } |
| 15 | |
| 16 | class WordPressDbStatement extends \Zend_Db_Statement { |
| 17 | |
| 18 | private $result; |
| 19 | private $sql; |
| 20 | |
| 21 | public function __construct( $adapter, $sql, $result ) { |
| 22 | $this->result = $result; |
| 23 | $this->_adapter = $adapter; |
| 24 | $this->sql = $sql; |
| 25 | } |
| 26 | |
| 27 | public function closeCursor() { |
| 28 | // not needed |
| 29 | } |
| 30 | |
| 31 | public function columnCount() { |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | public function errorCode() { |
| 36 | // not needed |
| 37 | } |
| 38 | |
| 39 | public function errorInfo() { |
| 40 | // not needed |
| 41 | } |
| 42 | |
| 43 | public function fetch( $style = null, $cursor = null, $offset = null ) { |
| 44 | if ( is_array( $this->result ) && ! empty( $this->result ) ) { |
| 45 | return array_shift( $this->result ); |
| 46 | } |
| 47 | |
| 48 | return $this->result; |
| 49 | } |
| 50 | |
| 51 | public function nextRowset() { |
| 52 | // not needed |
| 53 | } |
| 54 | |
| 55 | public function rowCount() { |
| 56 | if ( is_array( $this->result ) ) { |
| 57 | return count( $this->result ); |
| 58 | } |
| 59 | |
| 60 | return $this->result; |
| 61 | } |
| 62 | } |
| 63 |