LEPTON CMS 7.2.0
feel free to keep it strictly simple...
|
Public Member Functions | |
__construct (array &$settings=[]) | |
__destruct () | |
get_error () | |
is_error () | |
get_db_handle () | |
get_db_key () | |
connect (array &$settings=[]) | |
simple_query (string $sMySQL_Query="", array $aParams=[]) | |
get_one (string $SQL) | |
list_tables (string $strip="") | |
describe_table (string $sTableName, array &$aStorage=[], int $iForm=self::DESCRIBE_RAW) | |
execute_query (string $aQuery="", bool $bFetch=false, array &$aStorage=[], bool $bFetchAll=true) | |
build_and_execute (string $type, string $table_name, array $table_values, string $condition="", string $key="") | |
query (string $sSqlQuery="") | |
add_column (string $table='', string $column='', string $desc='') | |
Static Public Member Functions | |
static | getInstance (array &$settings=[]) |
Data Fields | |
const | DESCRIBE_RAW = 0 |
const | DESCRIBE_ASSOC = 1 |
const | DESCRIBE_ONLY_NAMES = 2 |
bool | $bHaltOnError = true |
bool | $bForceDieOnError = true |
Protected Member Functions | |
set_error (string $error='') | |
This file is part of LEPTON Core, released under the GNU GPL Please see LICENSE and COPYING files in your package for details, specially for terms and warranties.
NOTICE:LEPTON CMS Package has several different licenses. Please see the individual license in the header of each single file or info.php of modules and templates.
Definition at line 24 of file lepton_database.php.
__construct | ( | array & | $settings = [] | ) |
Constructor of the class database
array | $settings | Assoc. array with the connection-settings. Call by reference! |
@seealso Method "connect" for details.
Definition at line 96 of file lepton_database.php.
__destruct | ( | ) |
Destructor of the class database
Definition at line 104 of file lepton_database.php.
add_column | ( | string | $table = '', |
string | $column = '', | ||
string | $desc = '' ) |
Add column to existing table
string | $table | The table name to be extended. |
string | $column | Name |
string | $desc | column type and default |
Definition at line 769 of file lepton_database.php.
build_and_execute | ( | string | $type, |
string | $table_name, | ||
array | $table_values, | ||
string | $condition = "", | ||
string | $key = "" ) |
Public function to build and execute a mySQL query direct. Use this function/method for update and insert values only. As for a simple select you can use "prepare_and_execute" above.
string | $type | A "job"-type: this time only "update" and "insert" are supported. |
string | $table_name | A valid table-name (incl. table-prefix). |
array | $table_values | An array within the table-field-names and values. |
string | $condition | An optional condition for "update" - this time a simple string. |
string | $key | An optional "no update" key field to be excluded on update while "insert_on_duplicate_key_update" - a simple string containing 1 key field. |
Definition at line 633 of file lepton_database.php.
|
final |
Establish the connection to the desired database defined in /config.php.
This function does not connect multiple times, if the connection is already established the existing database handle will be used.
array | $settings | Assoc. array within optional settings. Pass by reference! |
@notice Param 'settings' is an assoc. array with the connection-settings, e.g.: $settings = array( 'host' => "example.tld", 'user' => "example_user_string", 'pass' => "example_user_password", 'name' => "example_database_name", 'port' => "1003", 'key' => "a unique key", // optional 'cipher' => "aes-256-cbc", // optional 'iv' => "12_%#0123773345_", // MUST be match to the given 'cipher'! 'ivlen' => 16, // MUST be set if 'iv' has a different length than 16! 'charset' => "utf8" );
KEEP in mind, that the optional keys are set in the lepton.ini.php! So if you try to use the secure_* methods on a new connection via the $settings there can be causes some unintended results if these keys are missing or formatted!
To set up the connection to another charset as 'utf8' you can also define another one inside the config.php e.g. define('DB_CHARSET', 'utf8');
Any System-constants?
Try to set the charset.
Since 4.0 there could be also a setting for the MYSQL-Mode in the lepton.ini.
Definition at line 191 of file lepton_database.php.
describe_table | ( | string | $sTableName, |
array & | $aStorage = [], | ||
int | $iForm = self::DESCRIBE_RAW ) |
Placed for all fields from a given table(-name) an assoc. array inside a given storage-array.
string | $sTableName | A valid table-name. |
array | $aStorage | An array to store the results. Call by reference! |
Definition at line 528 of file lepton_database.php.
execute_query | ( | string | $aQuery = "", |
bool | $bFetch = false, | ||
array & | $aStorage = [], | ||
bool | $bFetchAll = true ) |
Definition at line 596 of file lepton_database.php.
get_db_handle | ( | ) |
Get the MySQL DB handle
Definition at line 144 of file lepton_database.php.
get_db_key | ( | ) |
get_error | ( | ) |
get_one | ( | string | $SQL | ) |
Execute a SQL query and return the first row of the result array
string | $SQL | Any SQL-Query or statement |
Definition at line 441 of file lepton_database.php.
|
static |
Return the (singleton) instance of this class.
array | $settings | Optional params - see "connect" for details |
Definition at line 75 of file lepton_database.php.
is_error | ( | ) |
Check if there occurred any error
Definition at line 134 of file lepton_database.php.
list_tables | ( | string | $strip = "" | ) |
Returns a linear array within the table-names of the current database
string | $strip | A string to 'strip' chars from the table-names, e.g. the prefix. |
Definition at line 482 of file lepton_database.php.
query | ( | string | $sSqlQuery = "" | ) |
Execute a SQL query and return a handle to queryMySQL
string | $sSqlQuery | The query string to be executed. |
Definition at line 736 of file lepton_database.php.
|
protected |
Set error an error message.
string | $error |
Definition at line 114 of file lepton_database.php.
simple_query | ( | string | $sMySQL_Query = "", |
array | $aParams = [] ) |
Execute a mysql-query without returning a result. A typical use is e.g. "DROP TABLE IF EXIST" or "SET NAMES ..."
string | $sMySQL_Query | Any (MySQL-) Query |
array | $aParams | Optional array within the values if place-holders are used. |
Definition at line 404 of file lepton_database.php.
bool $bForceDieOnError = true |
Definition at line 66 of file lepton_database.php.
boolean $bHaltOnError = true |
Public var to handle displaying the errors during the processes. (Makes use of LEPTON_tools::display)
@seeAlso LEPTON_tools::display
Definition at line 64 of file lepton_database.php.
const DESCRIBE_ASSOC = 1 |
Definition at line 29 of file lepton_database.php.
const DESCRIBE_ONLY_NAMES = 2 |
Definition at line 30 of file lepton_database.php.
const DESCRIBE_RAW = 0 |
Definition at line 28 of file lepton_database.php.