libraries:databaseconnector:databaseconnectorclass
DatabaseConnector class
This class provides all methods and functionality for database connections and execution of SQL statements.
Constructors
__construct() | The class constructor with basic settings |
Connection methods
Connect() | General connection method which uses a DSN string (it's recommended to use the methods below) |
ConnectMysql() | Establish a connection to a MySql database |
ConnectPostgresql() | Establish a connection to a Postgresql database |
ConnectSqlite2() | Establish a connection to a Sqlite2 database |
ConnectSqlite3() | Establish a connection to a Sqlite3 database |
Disconnect() | Disconnects the current database connection |
Connection information methods
GetAvailableDrivers() | Returns information about what PDO drivers are supported/installed on the server |
GetDBType() | Returns the name of the currently used database driver |
GetLastError() | Returns the last occured error message |
IsConnected() | Checks if a database is currently connected |
Transaction methods
TransactionStart() | Starts a transaction (if the database supports it) |
TransactionCommit() | Executes a commit on the currently running transaction |
TransactionRollback() | Executes a rollback on the currently running transaction |
GetTransactionLevel() | Returns the level of the running transaction (if nested) |
Query execution methods
SqlExecute() | Executes a SQL query without expecting a return value |
SqlExecutePrepared() | Executes a prepared SQL statement without expecting a return value |
SqlGetExecutionTime() | Returns the duration of the last executed SQL query in milliseconds |
SqlGetFirstLine() | Executes a query and returns the first row of the result as array of strings |
SqlGetFirstLineAsObject() | Executes a query and returns the first row of the result as array of PHP objects |
SqlGetFirstPreparedLine() | Executes a prepared statement and returns the first row of the result as array of strings |
SqlGetFirstPreparedLineAsObject() | Executes a prepared statement and returns the first row of the result as array of PHP objects |
SqlGetNextLine() | Returns the next row of the result as array of strings |
SqlGetNextLineAsObject() | Returns the next row of the result as array of PHP objects |
SqlGetNextPreparedLine() | Returns the next row of the prepared statement's result as array of strings |
SqlGetNextPreparedLineAsObject() | Returns the next row of the prepared statement's result as array of PHP objects |
SqlGetLastInsertId() | Returns the ID, that was created with the last inserted dataset |
SqlGetLines() | Executes a query and returns the result as array or strings |
SqlGetLinesAsObject() | Executes a query and returns the result as array of PHP objects |
SqlGetPreparedLines() | Executes a prepared statement and returns the result as array of strings |
SqlGetPreparedLinesAsObject() | Executes a prepared statement and returns the result as array of PHP objects |
SqlHasResult() | Checks if the SELECT statement would return at least one result |
SqlPrepareStatement() | Prepares an SQL statement with placeholders |
SqlBindPreparedParam() | Binds a variable to a prepared statement by reference |
SqlBindPreparedValue() | Binds a variable to a prepared statement by value |
libraries/databaseconnector/databaseconnectorclass.txt · Last modified: 2023/03/31 14:05 by michael.pohl