Class ComplexQuery
Define your complex SQL query. When implementing your complex query do not use global $wpdb; in your methods. Use ::getWpdb() instead.
A complex query can be splitted into three parts:
- 1. Single Query: The query can be processed through one single SQL query with user defined variables
- 2. Procedure: The procedure can write for example to an temporary table and reads again from this one
- 3. Fallback: The fallback can throw an error or do the query through PHP functions
- MatthiasWeb\RealMediaLibrary\base\Base
-
MatthiasWeb\RealMediaLibrary\comp\complexquery\ComplexQuery
Direct known subclasses
Namespace: MatthiasWeb\RealMediaLibrary\comp\complexquery
Example: $rows = new MyComplexQuery($wpdb)->getResults();
Located at comp/complexquery/ComplexQuery.class.php
Methods summary
public
|
|
public
|
|
abstract public
|
#
singleQuery( )
This function is called when user defined variables are support. This method should return your expected result. It works with both mysqli_connect and mysql_connect. |
abstract public
|
#
procedure( )
This function is called when procedures (stored functions and procedures) are available. It is also necessery that mysqli is in use. mysql_connect does not support store_results() method. This method should return your expected result. You should work with this::hasProcedure() to install your procedure if not exists. |
abstract public
|
|
final public
|
|
final protected
|
#
getProcedureResults( string $sql, boolean $returnTrue = false )
Call a "CALL proc" SQL and parse the results. |
public
|
|
public
|
#
isSingleQueriableWithUserDefinedVars( )
Checks if a single query is allowed to use @vars. For example MariaDB does not resolve @vars in a single query when they are not declared before. This method uses a cache (30 days). |
public
|
|
final public
|
|
public
|
|
public
|
|
public
|
|
public
|
Methods inherited from MatthiasWeb\RealMediaLibrary\base\Base
Constants summary
string |
CACHE_OPTION_NAME
|
#
"mw_complex_query"
|