Query\AbstractDriver
Base Database class
Extends PDO to simplify cross-database issues
Synopsis
- // members
- protected PDOStatement $statement;
- protected string $escape_char = '"';
- protected SQL_Interface $sql;
- protected Abstract_Util $util;
- protected $last_query;
- protected string $table_prefix = '';
- protected bool $has_truncate = TRUE;
- // methods
- public void __construct()
- protected void _load_sub_classes()
- public mixed __call()
- public string get_last_query()
- public void set_last_query()
- public SQL_Interface get_sql()
- public Abstract_Util get_util()
- public void set_table_prefix()
- public PDOStatement prepare_query()
- public PDOStatement prepare_execute()
- public int affected_rows()
- public string prefix_table()
- public string quote_table()
- public string quote_ident()
- public array get_schemas()
- public array get_tables()
- public array get_dbs()
- public array get_views()
- public array get_sequences()
- public array get_functions()
- public array get_procedures()
- public array get_triggers()
- public array get_system_tables()
- public array get_columns()
- public array get_fks()
- public array get_indexes()
- public array get_types()
- public array driver_query()
- public int num_rows()
- public null|array<string|array|null> insert_batch()
- public mixed _quote()
- protected string _prefix()
- public PDOStatement truncate()
- // Inherited methods from PDO
- public void __construct()
- public bool beginTransaction()
- public bool commit()
- public mixed errorCode()
- public array errorInfo()
- public int exec()
- public mixed getAttribute()
- public array getAvailableDrivers()
- public bool inTransaction()
- public string lastInsertId()
- public PDOStatement prepare()
- public PDOStatement query()
- public string quote()
- public bool rollBack()
- public bool setAttribute()
Hierarchy
Members
protected
- $escape_char
—
string
Character to escape identifiers - $has_truncate
—
Query\bool
Whether the driver supports 'TRUNCATE' - $last_query
—
string
Last query executed - $sql
—
Query\SQL_Interface
Reference to sql class - $statement
—
\PDOStatement
Reference to the last executed query - $table_prefix
—
string
Prefix to apply to table names - $util
—
Query\Abstract_Util
Reference to util class
Methods
protected
- _load_sub_classes() — Loads the subclasses for the driver
- _prefix() — Sets the table prefix on the passed string
public
- __construct() — PDO constructor wrapper
- __call() — Allow invoke to work on table object
- _quote() — Helper method for quote_ident
- affected_rows() — Returns number of rows affected by an INSERT, UPDATE, DELETE type query
- driver_query() — Method to simplify retrieving db results for meta-data queries
- get_columns() — Retrieve column information for the current database table
- get_dbs() — Return list of dbs for the current connection, if possible
- get_fks() — Retrieve foreign keys for the table
- get_functions() — Return list of functions for the current database
- get_indexes() — Retrieve indexes for the table
- get_last_query() — Get the last sql query exexcuted
- get_procedures() — Return list of stored procedures for the current database
- get_schemas() — Return schemas for databases that list them
- get_sequences() — Return list of sequences for the current database, if they exist
- get_sql() — Get the SQL class for the current driver
- get_system_tables() — Retrieves an array of non-user-created tables for the connection/database
- get_tables() — Return list of tables for the current database
- get_triggers() — Return list of triggers for the current database
- get_types() — Retrieve list of data types for the database
- get_util() — Get the Util class for the current driver
- get_views() — Return list of views for the current database
- insert_batch() — Create sql for batch insert
- num_rows() — Return the number of rows returned for a SELECT query
- prefix_table() — Prefixes a table if it is not already prefixed
- prepare_execute() — Create and execute a prepared statement with the provided parameters
- prepare_query() — Simplifies prepared statements for database queries
- quote_ident() — Surrounds the string with the databases identifier escape characters
- quote_table() — Quote database table name, and set prefix
- set_last_query() — Set the last query sql
- set_table_prefix() — Set the common table name prefix
- truncate() — Empty the passed table
Inherited from PDO
public
- beginTransaction() — Initiates a transaction
- commit() — Commits a transaction
- errorCode() — Fetch the SQLSTATE associated with the last operation on the database handle
- errorInfo() — Fetch extended error information associated with the last operation on the database handle
- exec() — Execute an SQL statement and return the number of affected rows
- getAttribute() — Retrieve a database connection attribute
- getAvailableDrivers() — Return an array of available PDO drivers
- inTransaction() — Checks if inside a transaction
- lastInsertId() — Returns the ID of the last inserted row or sequence value
- prepare() — Prepares a statement for execution and returns a statement object
- query() — Executes an SQL statement, returning a result set as a PDOStatement object
- quote() — Quotes a string for use in a query.
- rollBack() — Rolls back a transaction
- setAttribute() — Set an attribute
History
-
2015-11-10T10:12:23-05:00 (commit #b5a141f)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
Make class names Pascal Case
-
2015-07-31T10:56:16-04:00 (commit #555865b)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Update docs
-
2015-07-30T16:40:30-04:00 (commit #225017a)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Lots of refactoring -- accessors/mutators instead of direct access, reduce query builder test database connections, and simplify some logic
-
2015-07-30T13:13:12-04:00 (commit #8669fcc)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Some scrutinizer fixes
-
2015-07-29T16:51:17-04:00 (commit #8511c6a)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Move library into src folder, fix simpletest test runner
-
2015-07-17T16:01:41-04:00 (commit #b4118ce)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Update docs
-
2015-07-17T15:38:06-04:00 (commit #28f5cb2)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Fix Firebird tests and speed up tests by using one database connection for each query builder datbase test
-
2015-07-16T16:56:13-04:00 (commit #bfc3ea3)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Reorganize drivers into a more modern layout
-
2014-08-08T13:48:20-04:00 (commit #dd672df)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Reorganize classes to autoload by namespace
-
2014-08-08T12:48:14-04:00 (commit #0a0548d)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Remove some useless code, extract an exception into its own class
-
2014-07-15T11:01:47-04:00 (commit #2ae2064)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Fix some very minor code quality issues
-
2014-06-30T11:01:44-04:00 (commit #7fd90ab)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Remove Table Builder classes
-
2014-04-28T16:41:46-04:00 (commit #6a38213)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Improve some tests and docblocks
-
2014-04-24T20:14:19-04:00 (commit #2ae38be)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Remove some variable setting logic duplication
-
2014-04-24T17:07:50-04:00 (commit #81be910)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Split Query Builder class
-
2014-04-24T16:28:48-04:00 (commit #9da781d)
Author: Timothy J. Warren (tim@timshomepage.net) / Commiter: Timothy J. Warren (tim@timshomepage.net)
Fix access of member variable