PHP Class Microweber\Providers\Database\Utils

Query helper class
Show file Open project: microweber/microweber

Public Properties

Property Type Description
$cache_minutes
$default_limit
$table_fields
$table_prefix

Public Methods

Method Description
add_table_index ( $aIndexName, $aTable, $aOnColumns, $indexmeta = false )
assoc_table_name ( $assoc_name )
build_table ( $table_name, $fields_to_add, $use_cache = false )
build_tables ( $tables )
clean_input ( $input )
escape_string ( string | array $value ) : mixed Escapes a string from sql injection.
get_fields ( $table ) : array Gets all field names from a DB table.
get_prefix ( )
get_sql_engine ( )
get_table_ddl ( $full_table_name )
get_tables_list ( )
guess_cache_group ( $group )
import_sql_file ( $full_path_to_file ) : boolean Imposts SQL file in the DB.
map_array_to_table ( $table, $array ) : array Returns an array that contains only keys that has the same names as the table fields from the database.
query_log ( )
real_table_name ( $assoc_name )
remove_comments_from_sql_string ( $output ) : string Will strip the sql comment lines out of an given sql string.
remove_sql_remarks ( $sql )
split_sql_file ( $sql, $delimiter )
update_position_field ( $table, $data = [] )

Private Methods

Method Description
_exec_table_builder ( $table_name, $fields_to_add )

Method Details

add_table_index() public method

public add_table_index ( $aIndexName, $aTable, $aOnColumns, $indexmeta = false )

assoc_table_name() public method

public assoc_table_name ( $assoc_name )

build_table() public method

public build_table ( $table_name, $fields_to_add, $use_cache = false )

build_tables() public method

public build_tables ( $tables )

clean_input() public method

public clean_input ( $input )

escape_string() public method

Escapes a string from sql injection.
public escape_string ( string | array $value ) : mixed
$value string | array to escape
return mixed Escaped string

get_fields() public method

Gets all field names from a DB table.
Author: Peter Ivanov
public get_fields ( $table ) : array
$table string - table name
return array

get_prefix() public method

public get_prefix ( )

get_sql_engine() public method

public get_sql_engine ( )

get_table_ddl() public method

public get_table_ddl ( $full_table_name )

get_tables_list() public method

public get_tables_list ( )

guess_cache_group() public method

public guess_cache_group ( $group )

import_sql_file() public method

Imposts SQL file in the DB.
public import_sql_file ( $full_path_to_file ) : boolean
$full_path_to_file
return boolean

map_array_to_table() public method

Returns an array that contains only keys that has the same names as the table fields from the database.
public map_array_to_table ( $table, $array ) : array
return array

query_log() public method

public query_log ( )

real_table_name() public method

public real_table_name ( $assoc_name )

remove_comments_from_sql_string() public method

Will strip the sql comment lines out of an given sql string.
public remove_comments_from_sql_string ( $output ) : string
$output the SQL string with comments
return string $output the SQL string without comments

remove_sql_remarks() public method

public remove_sql_remarks ( $sql )

split_sql_file() public method

public split_sql_file ( $sql, $delimiter )

update_position_field() public method

public update_position_field ( $table, $data = [] )

Property Details

$cache_minutes public property

public $cache_minutes

$default_limit public property

public $default_limit

$table_fields public property

public $table_fields

$table_prefix public property

public $table_prefix