-
Notifications
You must be signed in to change notification settings - Fork 0
Database
Damon V. Caskey edited this page Jul 19, 2017
·
3 revisions
~In Progress
The database class is where you will execute queries against the Database engine and parse results. Once you have established a connection to the database engine, you may then initialize a database object to begin running queries. Results from the database engine may be output in various layouts.
// Members
private $config = NULL, // Class configuration object.
private $connect = NULL; // DB connection object.
private $line_config = NULL, // Line get configuration object.
private $params = array(), // SQL parameters.
private $sql = NULL, // SQL string.
private $statement = NULL, // Prepared/Executed query reference.
// Methods
// Magic
public function __construct(Connect $connect = NULL, DatabaseConfig $options = NULL, LineConfig $line_config = NULL)
public function __destruct()
// Constructors - Populate member with argument if valid object. Otherwise populate with a new default object.
private function construct_config(DatabaseConfig $value = NULL)
private function construct_connection(Connect $value = NULL)
private function construct_line_config(LineConfig $value = NULL)
// Accessors
public function get_config()
public function get_connection()
public function get_line_config()
public function get_param_array()
public function get_sql()
public function get_statement()
// Mutators
public function set_config(DatabaseConfig $value)
public function set_connection(Connect $value)
public function set_line_config(LineConfig $value)
public function set_param_array(array $value)
public function set_sql($value)
// Request
public function free_statement() // Free statement and clear statement member.
public function query_execute() // Execute prepared query with current parameters.
public function query_prepare() // Prepare query. Returns statement reference and updates data member.
public function query_run() // Prepare and execute query.
// Results
public function get_field_count() // Return number of fields from query result.
public function get_field_metadata() // Fetch and return table row's metadata array (column names, types, etc.).
public function get_line_array() // Fetch line array from table rows.
public function get_line_array_all() // Create and return a 2D array consisting of all line arrays from database query.
public function get_line_array_list() // Create and return a linked list consisting of all line elements from database query.
public function get_line_object() // Fetch and return line object from table rows.
public function get_line_object_all() // Create and return an array consisting of all line objects from database query.
public function get_line_object_list() // Create and return a linked list consisting of all line objects from database query.
public function get_next_result() // Move to and return next result set.
public function get_row_count() // Return number of records from query result.
public function get_row_exists() // Verify result set contains any rows.
To begin, first establish a connection to the database engine. You may then initialize a database object.
$yukon_database = new \dc\yukon\Database($yukon_connection);