PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.2.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.2.0
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 3.10.4 All 148 releases
← All changes | classes/Visualizer/Source/Query.php +10 -21 3.1.03.2.0 View file →
@@ -35,16 +35,8 @@
35 35 */
36 36 protected $_query;
37 37
38 38 /**
39 - * The error message.
40 - *
41 - * @access protected
42 - * @var string
43 - */
44 - protected $_error;
45 -
46 - /**
47 39 * Constructor.
48 40 *
49 41 * @access public
50 42 * @param string $query The query.
@@ -56,12 +48,14 @@
56 48 /**
57 49 * Fetches information from source, parses it and builds series and data arrays.
58 50 *
59 51 * @param bool $as_html Should the result be fetched as an HTML table or as an object.
52 + * @param bool $results_as_numeric_array Should the result be fetched as ARRAY_N instead of ARRAY_A.
53 + * @param bool $raw_results Should the result be returned without processing.
60 54 * @access public
61 55 * @return boolean TRUE on success, otherwise FALSE.
62 56 */
63 - public function fetch( $as_html = false ) {
57 + public function fetch( $as_html = false, $results_as_numeric_array = false, $raw_results = false ) {
64 58 if ( empty( $this->_query ) ) {
65 59 return false;
66 60 }
67 61
@@ -66,18 +60,23 @@
66 60 }
67 61
68 62 // impose a limit if no limit clause is provided.
69 63 if ( strpos( strtolower( $this->_query ), ' limit ' ) === false ) {
70 - $this->_query .= ' LIMIT ' . apply_filters( 'visualizer_sql_query_limit', 300 );
64 + $this->_query .= ' LIMIT ' . apply_filters( 'visualizer_sql_query_limit', 1000 );
71 65 }
72 66
73 67 global $wpdb;
74 68 $wpdb->hide_errors();
75 69 // @codingStandardsIgnoreStart
76 - $rows = $wpdb->get_results( $this->_query, ARRAY_A );
70 + $rows = $wpdb->get_results( $this->_query, $results_as_numeric_array ? ARRAY_N : ARRAY_A );
71 + do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'Firing query %s to get results %s with error %s', $this->_query, print_r( $rows, true ), print_r( $wpdb->last_error, true ) ), 'debug', __FILE__, __LINE__ );
77 72 // @codingStandardsIgnoreEnd
78 73 $wpdb->show_errors();
79 74
75 + if ( $raw_results ) {
76 + return $rows;
77 + }
78 +
80 79 if ( $rows ) {
81 80 $results = array();
82 81 $headers = array();
83 82 if ( $rows ) {
@@ -168,18 +167,8 @@
168 167 }
169 168 $this->_data = $data;
170 169
171 170 return true;
172 - }
173 -
174 - /**
175 - * Returns the error, if any.
176 - *
177 - * @access public
178 - * @return string
179 - */
180 - public function get_error() {
181 - return $this->_error;
182 171 }
183 172
184 173 /**
185 174 * Returns the final query.