public static
Magdb_::Magdb()
|
#
Instance( )
This is a singleton!
Instance loader
This is a singleton!
Instance loader
Returns
|
public
|
#
Magdb( )
This is a singleton!
Should be called by private method Instance.
Don't implement new ones
This is a singleton!
Should be called by private method Instance.
Don't implement new ones
|
public
|
#
SetConnectionArray( array $dsn_arr )
Sets the connection array object
Sets the connection array object
Parameters
- $dsn_arr
array with connection data, as the sample:
array(
'phptype' => 'mysql',
'hostspec' => $host,
'database' => $database,
'username' => $username,
'password' => $password,
);
|
public
|
#
SetConnection( string $host, string $database, string $username, string $password )
Setups connection
Parameters
- $host
- host address for connection
- $database
- database name
- $username
- username for connection
- $password
- password for connection
|
public
|
#
SetFetchMode( string $fetch )
Sets fetchmode, according with MDB2 values. Default mode: assoc.
Sets fetchmode, according with MDB2 values. Default mode: assoc.
Parameters
- $fetch
fetchmode for SQL returns
options available:
ordered:
array with results ordered according with select statement
assoc:
array with keys as the column names
object:
object with columns as propertoies
if anything different from those values is sent, "assoc" is used
|
public
boolean
|
#
OpenConnectionPlease( )
Open connection, please. Please! 0=)
Open connection, please. Please! 0=)
Returns
boolean true or false, if connection succedded
Throws
MagratheaDbException
|
public
|
|
public
object
|
#
Query( string $sql )
executes the query and returns the full data
executes the query and returns the full data
Parameters
- $sql
- Query to be executed
Returns
object $result Result of the query
|
public
array
|
#
QueryAll( string $sql )
executes the query and returns the full data in an array
executes the query and returns the full data in an array
Parameters
- $sql
- Query to be executed
Returns
array $result Result of the query (one row for line result)
|
public
object
|
#
QueryRow( string $sql )
executes the query and returns only the first row of the result
executes the query and returns only the first row of the result
Parameters
- $sql
- Query to be executed
Returns
object $result First line of the query
|
public
object
|
#
QueryOne( string $sql )
executes the query and returns only the first value of the first row of the result
executes the query and returns only the first value of the first row of the result
Parameters
- $sql
- Query to be executed
Returns
object $result First value of the first line
|
public
|
#
QueryTransaction( array $query_array )
receives an array of queries and executes them all
receives an array of queries and executes them all
Parameters
- $query_array
- Array of queries to be executed
Throws
|
public
|
#
PrepareAndExecute( string $query, array $arrTypes, array $arrValues )
Prepares and execute a query and returns the inserted id (if any)
Prepares and execute a query and returns the inserted id (if any)
Parameters
- $query
- Query to be executed
- $arrTypes
- Array of types from the values to be inserted
- $arrValues
- Array of values to be inserted
|