PHP Class Give_DB, Give

This class is for interacting with the database table.
Since: 1.0
ファイルを表示 Open project: wordimpress/give

Public Properties

Property Type Description
$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

Public Methods

Method Description
__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

Method Details

__construct() public method

Set up the Give DB Class.
Since: 1.0
public __construct ( )

delete() public method

Delete a row identified by the primary key
Since: 1.0
public delete ( integer $row_id ) : boolean
$row_id integer Column ID.
return boolean

get() public method

Retrieve a row by the primary key
Since: 1.0
public get ( integer $row_id ) : object
$row_id integer Row ID.
return object

get_by() public method

Retrieve a row by a specific column / value
Since: 1.0
public get_by ( integer $column, integer $row_id ) : object
$column integer Column ID.
$row_id integer Row ID.
return object

get_column() public method

Retrieve a specific column's value by the primary key
Since: 1.0
public get_column ( integer $column, integer $row_id ) : string
$column integer Column ID.
$row_id integer Row ID.
return string Column value.

get_column_by() public method

Retrieve a specific column's value by the the specified column / value
Since: 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.
return string

get_column_defaults() public method

Default column values
Since: 1.0
public get_column_defaults ( ) : array
return array Default column values.

get_columns() public method

Whitelist of columns
Since: 1.0
public get_columns ( ) : array
return array Columns

insert() public method

Insert a new row
Since: 1.0
public insert ( array $data, string $type = '' ) : integer
$data array
$type string
return integer

installed() public method

Check if the table was ever installed
Since: 1.6
public installed ( ) : boolean
return boolean Returns if the customers table was installed and upgrade routine run.

table_exists() public method

Check if the given table exists
Since: 1.3.2
public table_exists ( string $table ) : boolean
$table string The table name.
return boolean If the table name exists.

update() public method

Update a row
Since: 1.0
public update ( integer $row_id, array $data = [], string $where = '' ) : boolean
$row_id integer Column ID
$data array
$where string Column value
return boolean

Property Details

$primary_key public_oe property

The name of the primary column
Since: 1.0
public string $primary_key
return string

$table_name public_oe property

The name of our database table
Since: 1.0
public string $table_name
return string

$version public_oe property

The version of our database table
Since: 1.0
public string $version
return string