PHP Класс Give_DB, Give

This class is for interacting with the database table.
С версии: 1.0
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$primary_key string The name of the primary column
$table_name string The name of our database table
$version string The version of our database table

Открытые методы

Метод Описание
__construct ( ) Class Constructor
delete ( integer $row_id ) : boolean Delete a row identified by the primary key
get ( integer $row_id ) : object Retrieve a row by the primary key
get_by ( integer $column, integer $row_id ) : object Retrieve a row by a specific column / value
get_column ( integer $column, integer $row_id ) : string Retrieve a specific column's value by the primary key
get_column_by ( integer $column, string $column_where, string $column_value ) : string Retrieve a specific column's value by the the specified column / value
get_column_defaults ( ) : array Default column values
get_columns ( ) : array Whitelist of columns
insert ( array $data, string $type = '' ) : integer Insert a new row
installed ( ) : boolean Check if the table was ever installed
table_exists ( string $table ) : boolean Check if the given table exists
update ( integer $row_id, array $data = [], string $where = '' ) : boolean Update a row

Описание методов

__construct() публичный Метод

Set up the Give DB Class.
С версии: 1.0
public __construct ( )

delete() публичный Метод

Delete a row identified by the primary key
С версии: 1.0
public delete ( integer $row_id ) : boolean
$row_id integer Column ID.
Результат boolean

get() публичный Метод

Retrieve a row by the primary key
С версии: 1.0
public get ( integer $row_id ) : object
$row_id integer Row ID.
Результат object

get_by() публичный Метод

Retrieve a row by a specific column / value
С версии: 1.0
public get_by ( integer $column, integer $row_id ) : object
$column integer Column ID.
$row_id integer Row ID.
Результат object

get_column() публичный Метод

Retrieve a specific column's value by the primary key
С версии: 1.0
public get_column ( integer $column, integer $row_id ) : string
$column integer Column ID.
$row_id integer Row ID.
Результат string Column value.

get_column_by() публичный Метод

Retrieve a specific column's value by the the specified column / value
С версии: 1.0
public get_column_by ( integer $column, string $column_where, string $column_value ) : string
$column integer Column ID.
$column_where string Column name.
$column_value string Column value.
Результат string

get_column_defaults() публичный Метод

Default column values
С версии: 1.0
public get_column_defaults ( ) : array
Результат array Default column values.

get_columns() публичный Метод

Whitelist of columns
С версии: 1.0
public get_columns ( ) : array
Результат array Columns

insert() публичный Метод

Insert a new row
С версии: 1.0
public insert ( array $data, string $type = '' ) : integer
$data array
$type string
Результат integer

installed() публичный Метод

Check if the table was ever installed
С версии: 1.6
public installed ( ) : boolean
Результат boolean Returns if the customers table was installed and upgrade routine run.

table_exists() публичный Метод

Check if the given table exists
С версии: 1.3.2
public table_exists ( string $table ) : boolean
$table string The table name.
Результат boolean If the table name exists.

update() публичный Метод

Update a row
С версии: 1.0
public update ( integer $row_id, array $data = [], string $where = '' ) : boolean
$row_id integer Column ID
$data array
$where string Column value
Результат boolean

Описание свойств

$primary_key публичное свойство

The name of the primary column
С версии: 1.0
public string $primary_key
Результат string

$table_name публичное свойство

The name of our database table
С версии: 1.0
public string $table_name
Результат string

$version публичное свойство

The version of our database table
С версии: 1.0
public string $version
Результат string