Source API for the «PorteConnection» class
Connection base class emulate some of the PDO methods and reproduce the same behavior unless specified otherwise.
The class along its extended specific implementation can be used independently of porte as a drop-in replacement of PDO (it does not yet implemement all PDO methods).
PHP magic methods
- __construct
-
Construct the connection from a configuration array.
-
- return
- null
- $config
- array
Public methods
- exec
-
Executes an SQL statement in a single function call, returning the number of rows affected by the statement.
-
- return
- int
- Number of rows that were modified or deleted by the SQL statement you issued or 0 if no rows were affected
- $statement
- object
- $retry[optional]
- object
- query
-
Execute a query or an array of queries in a single function call, returning the result set (if any) returned by the statement as a Statement object.
-
- return
- PorteStatement
- Provider statement instance
- $statement
- mixed[string,array], SQL
- or array of SQLs to be executed
- $retry[optional]
- int, Param
- reserved for internal purposes
- prepare
-
Prepares an SQL statement to be executed by the PDOStatement::execute() method.
The SQL statement can contain zero or more named (:name) or question mark (?) parameter markers for which real values will be substituted when the statement is executed.
Contrary to PDO implementation, you can use both parameter style.Calling the "prepare" method helps to prevent SQL injection attacks by eliminating the need to manually quote the parameters.
-
- return
- PorteStatement
- $statement
- string, Valid
- SQL statement for the target database server.
- quote
-
Places quotes around the input string (if required) and escapes special characters within the input string, using a quoting style appropriate to the underlying driver.
-
- return
- Returns
- a quoted string that is theoretically safe to pass into an SQL statement. Returns FALSE if the driver does not support quoting in this way.
- $string
- string, Text
- to quote
- lastInsertId
-
Returns the ID of the last inserted row or sequence value.
-
- return
- string
- ID of the last inserted row, or the last value from a sequence object, depending on the underlying driver.
- $name(optional)
- string, Name
- of the sequence object from which the ID should be returned.
- connect
-
Create a new connection object or resource with the databasse. Note, a new connection will only be create if it does not yet exist or if the configuration used to create the existing connection has changed since its creation. The method also deals with connection encoding.
- databaseCreate
-
Create a database of it does not already exists. This function does not check if the database already exists.
- tableClear
-
Empty a table completely and reset its internal counter.
- tableCreate
-
Create a table of it does not already exists. This function does not check if the table
already exists, in which case an error is thrown.
- tableDrop
-
Drop a table of it exists.
- tableDropColumn
-
This method is not yet documented.
- tableExists
-
This method is not yet documented.
- tableShowColumns
-
This method is not yet documented.
- tableShowIndexes
-
This method is not yet documented.
- supportCrossDatabaseQueries
-
This method is not yet documented.
- supportUnsigned
-
This method is not yet documented.
- filterColumnAlter
-
This method is not yet documented.
- writeTable
-
This method is not yet documented.
- makeColumnTypeInt
-
This method is not yet documented.
- makeColumnTypeBoolean
-
This method is not yet documented.