Class WPDA_Design_Table_Model

Base class to handle standard plugin table features

author Peter Schulz
since 1.1.0
package WPDataAccess\Plugin_Table_Models
inherited_from \WPDataAccess\Plugin_Table_Models\WPDA_Plugin_Table_Base_Model

 Methods

WPDA_Design_Table_Model constructor

__construct() 
since 1.1.0

Check if const BASE_TABLE_NAME is defined (cannot proceed without)

check_base_table_name() 
InheritedStatic

Return number of records in base table

count() : integer
InheritedStatic

Returns

integer

Convert MySQL data type to basic data type (used in basic mode)

datatype2basic(string $arg) : string
Static
since 1.6.0

Parameters

$arg

string

MySQL data type.

Returns

stringBasic data type.

Get base table name

get_base_table_name() : string
InheritedStatic

Returns

stringBase table name

Simple list containing all table names in data designer table

get_designer_table_list() : array
Static

Returns

array

Return table design

get_table_design() : null | array

Returns

nullarray

Get table type from MySQL dictionary

get_table_type(string $table_name, string $schema_name) : boolean
Static

Parameters

$table_name

string

Table name

$schema_name

string

Schema name

Returns

boolean

Add a new table design

insert() : boolean
since 1.1.0

Returns

booleanTRUE = insert successful, FALSE ; insert failed.

Reverse engineer table and store result in data designer table

insert_reverse_engineered($wpda_table_name, $wpda_schema_name, $wpda_table_design) : boolean
Static

Parameters

$wpda_table_name

$wpda_schema_name

$wpda_table_design

Returns

boolean

Prepare insert statement (process arguments)

prepare_insert() 
since 1.1.0

Prepare update statement

prepare_update() 
since 1.1.0 Get table structure from database and update it using the arguments in the request.

Get design for a specific table name

query(string|null $wpda_table_name_original = null, string|null $wpda_schema_name_original = null) : integer

Parameters

$wpda_table_name_original

stringnull

Table name to be queried. If null query 'wpda_table_name'.

$wpda_schema_name_original

stringnull

Schema name to be queried. If null query 'wpda_schema_name'.

Returns

integerNumber of rows.

Check if base table exists

table_exists() : boolean
InheritedStatic

Returns

booleanTRUE = table found

Update table design

update() : boolean
since 1.1.0

Returns

booleanTRUE = update successfull, FALSE ; update failed.

Perform validations and return array containing errors

validate() : array

Returns

arrayList of errors found.

Get table indexes from post variables

get_indexes() : array
since 1.1.0

Returns

arrayIndex design.

Get structure of table design from post variables

get_table_structure() : array
since 1.1.0

Returns

arrayTable design.

 Properties

 

Name of table where design is stored

$table_name : string | null

Default

null
 

Design database name

$wpda_schema_name : string | null

Default

null
 

Original design database name

$wpda_schema_name_original : string | null

Default

null

Used to detect a database name update.

 

The actual table design

$wpda_table_design : string | null

Default

null
 

Design table name

$wpda_table_name : string | null

Default

null
 

Original design table name

$wpda_table_name_original : string | null

Default

null

Used to detect a table name update.

 Constants

 

Base table name (without prefixes): MUST BE DEFINED IN SUBCLASS!!!

BASE_TABLE_NAME = 'wpda_table_design' 
inherited_from \WPDataAccess\Plugin_Table_Models\WPDA_Plugin_Table_Base_Model::BASE_TABLE_NAME
 

Base table name (without prefixes): MUST BE DEFINED IN SUBCLASS!!!

BASE_TABLE_NAME = null