Store Locator Plus®

SLP_Data extends SLPlus_BaseClass_Object
in package

The data interface helper.

Table of Contents

Properties

$collate  : string
$collate  : mixed
$db  : wpdb
$db  : mixed
$extension  : SLP_Data_Extension
$extension  : mixed
$from_slp_table  : string
$from_slp_table  : mixed
$group_by_clause  : string
$group_by_clause  : mixed
$had_where_clause  : bool
$had_where_clause  : mixed
$info  : array<string|int, string>
$info  : mixed
$options  : array<string|int, mixed>
$order_by_array  : array<string|int, string>
$order_by_array  : mixed
$order_by_clause  : string
$order_by_clause  : mixed
$slplus  : SLPlus
$sql_statement  : string
$sql_statement  : mixed
$uses_slplus  : bool
$where_clause  : string
$where_clause  : mixed
$slplus  : mixed
$uses_slplus  : mixed
$options  : mixed

Methods

__construct()  : mixed
__get()  : SLPlus_BaseClass_Object
__isset()  : bool
add_group_by_clause()  : string
Create a proper group by clause, adding the starting GROUP BY when necessary.
add_order_by_clause()  : string
Create a proper order by clause, adding the starting ORDER BY when necessary.
add_where_clause()  : string
Create a proper where clause, adding the starting WHERE when necessary.
extend_order_array()  : mixed
Add new strings to the order by array property.
extend_OrderBy()  : string
Add elements to the order by clause, adding a comma if needed.
extend_Where()  : string
Add elements to the where clause, adding AND if needed unless OR specified.
extend_WhereFieldMatches()  : string
Extend the database WHERE clause with a <field_name>='value' clause.
filter_SetWhereValidLatLong()  : string
Add the valid lat/long clause to the where statement.
get_instance()  : SLPlus_BaseClass_Object
Return an instance of the object which is also registered to the slplus global less the SLP_ part.
get_Record()  : mixed
Return a record as an array based on a given SQL select statement keys and params list.
get_SQL()  : string
Get an SQL statement for this database.
get_Value()  : array<string|int, mixed>
Return a single field as a value given SQL select statement keys and params list.
has_extended_data()  : mixed
Are there records in the extended data table used in the join? DOES NOT EVALUATE if extended data fields exist.
initialize()  : mixed
Initialize a new data object.
is_Extended()  : mixed
Returns true if there are ANY extended data fields in the meta table.
reset_clauses()  : mixed
Reset the SQL additive clauses.
reset_extended_data_flag()  : mixed
Reset and re-evaluate the has_extended_data flag.
set_database_meta()  : mixed
Set database meta info only AFTER DB is created.
set_properties()  : mixed
Set our properties.
join_location_tables()  : mixed
Join the base location table to the extended data location table as needed.

Properties

$collate

public string $collate

The collate modifier for create table commands.

$from_slp_table

public string $from_slp_table

$from_slp_table

public mixed $from_slp_table

$group_by_clause

public string $group_by_clause

The SQL group by clause

$group_by_clause

public mixed $group_by_clause = ''

$had_where_clause

public bool $had_where_clause

$had_where_clause

public mixed $had_where_clause = \false

$info

public array<string|int, string> $info

Info strings for the database interface. info['table'] = table name info['query'] = array of query strings

$options read-only

public array<string|int, mixed> $options

Persistent options for this module, stored in wp_options. => 'data_is_extended' : true if there are meta columns for extended data => 'has_extended_data' : true if there are records in the extended data table

$order_by_array

public array<string|int, string> $order_by_array

The various order by clauses used by the location selection clause.

$order_by_array

public mixed $order_by_array = array()

$order_by_clause

public string $order_by_clause

The SQL order by clause.

$order_by_clause

public mixed $order_by_clause = ''

$sql_statement

public string $sql_statement

The current SQL statement.

$sql_statement

public mixed $sql_statement = ''

$uses_slplus

public bool $uses_slplus

Set to true (default) if the object needs access to the SLPlus plugin object.

$where_clause

public string $where_clause

The SQL where clause.

$where_clause

public mixed $where_clause = ''

$options

private mixed $options = array('data_is_extended' => \null, 'has_extended_data' => \null)

Methods

__construct()

public __construct([array<string|int, mixed> $options = array() ]) : mixed
Parameters
$options : array<string|int, mixed> = array()

__isset()

public __isset(string $property) : bool
Parameters
$property : string
Return values
bool

add_group_by_clause()

Create a proper group by clause, adding the starting GROUP BY when necessary.

public add_group_by_clause( $new_clause) : string
Parameters
$new_clause :
Return values
string

add_order_by_clause()

Create a proper order by clause, adding the starting ORDER BY when necessary.

public add_order_by_clause([ $new_clause = null ]) : string
Parameters
$new_clause : = null
Return values
string

add_where_clause()

Create a proper where clause, adding the starting WHERE when necessary.

public add_where_clause( $new_clause[, mixed $joiner = 'AND' ]) : string
Parameters
$new_clause :
$joiner : mixed = 'AND'
Return values
string

extend_order_array()

Add new strings to the order by array property.

public extend_order_array( $new_string) : mixed
Parameters
$new_string :

extend_OrderBy()

Add elements to the order by clause, adding a comma if needed.

public extend_OrderBy(string $startwith, string $add) : string
Parameters
$startwith : string

the starting order by clause

$add : string

what to add

Return values
string

the extended order by with comma if needed (no ORDER BY prefix)

extend_Where()

Add elements to the where clause, adding AND if needed unless OR specified.

public extend_Where(string $startwith, string $add[, string $operator = 'AND' ]) : string
Parameters
$startwith : string

the starting where clause

$add : string

what to add

$operator : string = 'AND'

which operator to use to join the clause (default: AND)

Return values
string

the extended where clause

extend_WhereFieldMatches()

Extend the database WHERE clause with a <field_name>='value' clause.

public extend_WhereFieldMatches(string $where, string $field, string $value) : string
Parameters
$where : string

the current where clause

$field : string

the field name

$value : string

the value to compare against

Return values
string

the new where clause

filter_SetWhereValidLatLong()

Add the valid lat/long clause to the where statement.

public filter_SetWhereValidLatLong(string $where) : string
Parameters
$where : string

the current where clause without WHERE command

Return values
string

modified where clause

get_instance()

Return an instance of the object which is also registered to the slplus global less the SLP_ part.

public static get_instance([bool $no_global = false ][, mixed $params = array() ]) : SLPlus_BaseClass_Object

TODO: PHP7.4 and PHP8.0 the static instance variable returns an object matching $class TODO: PHP8.1 the static instance continually returns the FIRST object (SLP_Admin_Helper) every time -- it is like PHP8.1 static instance is bound to base_class-object versus the calling class object

Parameters
$no_global : bool = false

set to true to skip assigning object to SLP global as a property.

$params : mixed = array()

object init params

Return values
SLPlus_BaseClass_Object

get_Record()

Return a record as an array based on a given SQL select statement keys and params list.

public get_Record(array<string|int, string>|string $commandList[, array<string|int, mixed> $params = array() ][, int $offset = 0 ][, mixed $type = ARRAY_A ][, string $mode = 'get_row' ]) : mixed

Executes wpdb get_row using the specified SQL statement. If more than one row is returned by the query, only the specified row is returned by the function, but all rows are cached for later use. Returns NULL if no result is found

Parameters
$commandList : array<string|int, string>|string
$params : array<string|int, mixed> = array()
$offset : int = 0
$type : mixed = ARRAY_A

the type of object/array/etc. to return see wpdb get_row.

$mode : string = 'get_row'

= get_row or get_col to fetch a single row or multiple rows of a single column

Tags
link

WordPress WPDB Class

Return values
mixed

the database array_a or object.

get_SQL()

Get an SQL statement for this database.

public get_SQL(string|array<string|int, string> $commandList) : string

Processed the commandList in order.

Usually a select followed by a where and possibly a limit or order by

DELETE o delete - delete from store locator table

SELECT o selectall - select from store locator table with additional slp_extend_get_SQL_selectall filter. o selectall_with_distance - select from store locator table with additional slp_extend_get_SQL_selectall filter and distance calculation math, requires extra parm passing on get record. o selectslid - select only the store id from store locator table.

WHERE o where_default - the default where clause that is built up by the slp_ajaxsql_where filters. o where_default_validlatlong - the default with valid lat/long check check added. o whereslid - add where + slid selector, get record requires slid to be passed

ORDER BY o orderby_default - add order by if the results of the slp_ajaxsql_orderby filter returns order by criteria. AJAX listener default is by distance asc.

Parameters
$commandList : string|array<string|int, string>

a comma separated array of commands or a single command

Return values
string

get_Value()

Return a single field as a value given SQL select statement keys and params list.

public get_Value(array<string|int, string> $commandList[, array<string|int, mixed> $params = array() ]) : array<string|int, mixed>

If more than one record is returned it will only fetch the result of the first record.

Parameters
$commandList : array<string|int, string>
$params : array<string|int, mixed> = array()
Return values
array<string|int, mixed>

has_extended_data()

Are there records in the extended data table used in the join? DOES NOT EVALUATE if extended data fields exist.

public has_extended_data() : mixed

NOTE: this only returns true if there are RECORDS in the extended data table used in locaiton joins. this does NOT tell you if there are extended data fields in the data structure.

TODO: make this faster by making it persistent, but make sure you catch all the extended data insert/deletes.

initialize()

Initialize a new data object.

public initialize() : mixed

is_Extended()

Returns true if there are ANY extended data fields in the meta table.

public is_Extended() : mixed

reset_clauses()

Reset the SQL additive clauses.

public reset_clauses() : mixed

reset_extended_data_flag()

Reset and re-evaluate the has_extended_data flag.

public reset_extended_data_flag() : mixed

set_database_meta()

Set database meta info only AFTER DB is created.

public set_database_meta() : mixed

set_properties()

Set our properties.

public set_properties([array<string|int, mixed> $options = array() ]) : mixed
Parameters
$options : array<string|int, mixed> = array()

join_location_tables()

Join the base location table to the extended data location table as needed.

private join_location_tables() : mixed

        
On this page

Search results