WordPress at Your Fingertips
function is not described


DataStore::add_intervals_sql_params() protected WC 1.0

Fills FROM and WHERE clauses of SQL request for 'Intervals' section of data response based on user supplied parameters.

{} It's a method of the class: DataStore{}

No Hooks.


null. Nothing.


// protected - for code of main (parent) or child class
$result = $this->add_intervals_sql_params( $query_args, $table_name );
$query_args(array) (required)
Parameters supplied by the user.
$table_name(string) (required)
Name of the db table relevant for the date constraint.

Code of DataStore::add_intervals_sql_params() WC 6.1.0

protected function add_intervals_sql_params( $query_args, $table_name ) {
	$this->clear_sql_clause( array( 'from', 'where_time', 'where' ) );

	$this->add_time_period_sql_params( $query_args, $table_name );

	if ( isset( $query_args['interval'] ) && '' !== $query_args['interval'] ) {
		$interval = $query_args['interval'];
		$this->clear_sql_clause( 'select' );
		$this->add_sql_clause( 'select', TimeInterval::db_datetime_format( $interval, $table_name ) );