Experimental pdo database class.
Copyright: | 2008 Andrei Bautu |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 382 lines (14 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 1 file lib/dml/pdo_moodle_database.php |
sqlite3_pdo_moodle_database:: (16 methods):
driver_installed()
get_dbfamily()
get_dbtype()
configure_dbconnection()
create_database()
get_dsn()
get_dbfilepath()
get_tables()
get_indexes()
fetch_columns()
normalise_value()
get_limit_clauses()
delete_records()
sql_concat()
sql_concat_join()
sql_bitxor()
Class: sqlite3_pdo_moodle_database - X-Ref
Experimental pdo database classdriver_installed() X-Ref |
Detects if all needed PHP stuff installed. Note: can be used before connect() return: mixed true if ok, string if something |
get_dbfamily() X-Ref |
Returns database family type - describes SQL dialect Note: can be used before connect() return: string db family name (mysql, postgres, mssql, oracle, etc.) |
get_dbtype() X-Ref |
Returns more specific database driver type Note: can be used before connect() return: string db type mysqli, pgsql, oci, mssql, sqlsrv |
configure_dbconnection() X-Ref |
No description |
create_database($dbhost, $dbuser, $dbpass, $dbname, array $dboptions=null) X-Ref |
Attempt to create the database return: bool success param: string $dbhost param: string $dbuser param: string $dbpass param: string $dbname |
get_dsn() X-Ref |
Returns the driver-dependent DSN for PDO based on members stored by connect. Must be called after connect (or after $dbname, $dbhost, etc. members have been set). return: string driver-dependent DSN |
get_dbfilepath() X-Ref |
Returns the file path for the database file, computed from dbname and/or dboptions. If dboptions['file'] is set, then it is used (use :memory: for in memory database); else if dboptions['path'] is set, then the file will be <dboptions path>/<dbname>.sq3.php; else if dbhost is set and not localhost, then the file will be <dbhost>/<dbname>.sq3.php; else the file will be <moodle data path>/<dbname>.sq3.php return: string file path to the SQLite database; |
get_tables($usecache=true) X-Ref |
Return tables in database WITHOUT current prefix. return: array of table names in lowercase and without prefix param: bool $usecache if true, returns list of cached tables. |
get_indexes($table) X-Ref |
Return table indexes - everything lowercased return: array of arrays param: string $table The table we want to get indexes from. |
fetch_columns(string $table) X-Ref |
Returns detailed information about columns in table. return: array array of database_column_info objects indexed with column names param: string $table name |
normalise_value($column, $value) X-Ref |
Normalise values based in RDBMS dependencies (booleans, LOBs...) return: mixed the normalised value param: database_column_info $column column metadata corresponding with the value we are going to normalise param: mixed $value value we are going to normalise |
get_limit_clauses($sql, $limitfrom=0, $limitnum=0) X-Ref |
Returns the sql statement with clauses to append used to limit a recordset range. return: string the SQL statement with limiting clauses param: string $sql the SQL statement to limit. param: int $limitfrom return a subset of records, starting at this point (optional, required if $limitnum is set). param: int $limitnum return a subset comprising this many records (optional, required if $limitfrom is set). |
delete_records($table, array $conditions=null) X-Ref |
Delete the records from a table where all the given conditions met. If conditions not specified, table is truncated. return: returns success. param: string $table the table to delete from. param: array $conditions optional array $fieldname=>requestedvalue with AND in between |
sql_concat() X-Ref |
Returns the proper SQL to do CONCAT between the elements passed Can take many parameters return: string param: string $element |
sql_concat_join($separator="' '", $elements=array() X-Ref |
Returns the proper SQL to do CONCAT between the elements passed with a given separator return: string param: string $separator param: array $elements |
sql_bitxor($int1, $int2) X-Ref |
Returns the SQL text to be used in order to perform one bitwise XOR operation between 2 integers. return: string the piece of SQL code to be used in your statement. param: integer int1 first integer in the operation param: integer int2 second integer in the operation |