Class: MDB2_Extended
Source Location: /MDB2-2.5.0b5/MDB2/Extended.php
MDB2_Module_Common
|
--MDB2_Extended
MDB2_Extended: class which adds several high level methods to MDB2
Author(s):
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Method Detail
autoExecute [line 137]
bool|MDB2_Error autoExecute(
string
$table, array
$fields_values, [int
$mode = MDB2_AUTOQUERY_INSERT], [string
$where = false], [array
$types = null], [string
$result_class = true], [mixed
$result_types = MDB2_PREPARE_MANIP])
|
|
Generate an insert, update or delete query and call prepare() and execute() on it
Parameters:
autoPrepare [line 92]
resource autoPrepare(
string
$table, array
$table_fields, [int
$mode = MDB2_AUTOQUERY_INSERT], [string
$where = false], [array
$types = null], [mixed
$result_types = MDB2_PREPARE_MANIP])
|
|
Generate an insert, update or delete query and call prepare() on it
Parameters:
buildManipSQL [line 200]
string buildManipSQL(
string
$table, ordered
$table_fields, int
$mode, [string
$where = false])
|
|
Make automaticaly an sql query for prepare() Example : buildManipSQL('table_sql', array('field1', 'field2', 'field3'), MDB2_AUTOQUERY_INSERT) will return the string : INSERT INTO table_sql (field1,field2,field3) VALUES (?,?,?) NB : - This belongs more to a SQL Builder class, but this is a simple facility - Be carefull ! If you don't give a $where param with an UPDATE/DELETE query, all
the records of the table will be updated/deleted !
Parameters:
execParam [line 302]
int|MDB2_Error execParam(
string
$query, [array
$params = array()], [array
$param_types = null])
|
|
Execute a parameterized DML statement.
Parameters:
executeMultiple [line 646]
bool|MDB2_Error executeMultiple(
resource
$stmt, [array
$params = null])
|
|
This function does several execute() calls on the same statement handle. $params must be an array indexed numerically from 0, one execute call is done for every 'row' in the array. If an error occurs during execute(), executeMultiple() does not execute the unfinished rows, but rather returns that error.
Parameters:
getAfterID [line 708]
int|MDB2_Error getAfterID(
mixed
$id, string
$table, [string
$field = null])
|
|
Returns the autoincrement ID if supported or $id
Parameters:
getAll [line 493]
array|MDB2_Error getAll(
string
$query, [array
$types = null], [array
$params = array()], [array
$param_types = null], [int
$fetchmode = MDB2_FETCHMODE_DEFAULT], [bool
$rekey = false], [bool
$force_array = false], [bool
$group = false])
|
|
Fetch all the rows returned from a query.
Parameters:
getAssoc [line 599]
array|MDB2_Error getAssoc(
string
$query, [array
$types = null], [array
$params = array()], [array
$param_types = null], [
$fetchmode = MDB2_FETCHMODE_DEFAULT], [bool
$force_array = false], [bool
$group = false])
|
|
Fetch the entire result set of a query and return it as an associative array using the first column as the key. If the result set contains more than two columns, the value will be an array of the values from column 2-n. If the result set contains only two columns, the returned value will be a scalar with the value of the second column (unless forced to an array with the $force_array parameter). A MDB2 error code is returned on errors. If the result set contains fewer than two columns, a MDB2_ERROR_TRUNCATED error is returned. For example, if the table 'mytable' contains: ID TEXT DATE
--------------------------------
1 'one' 944679408
2 'two' 944679408
3 'three' 944679408 Then the call getAssoc('SELECT id,text FROM mytable') returns: array(
'1' => 'one',
'2' => 'two',
'3' => 'three',
) ...while the call getAssoc('SELECT id,text,date FROM mytable') returns: array(
'1' => array('one', '944679408'),
'2' => array('two', '944679408'),
'3' => array('three', '944679408')
) If the more than one row occurs with the same value in the first column, the last row overwrites all previous ones by default. Use the $group parameter if you don't want to overwrite like this. Example: getAssoc('SELECT category,id,name FROM mytable', null, null
MDB2_FETCHMODE_ASSOC, false, true) returns:
array(
'1' => array(array('id' => '4', 'name' => 'number four'),
array('id' => '6', 'name' => 'number six')
),
'9' => array(array('id' => '4', 'name' => 'number four'),
array('id' => '6', 'name' => 'number six')
)
) Keep in mind that database functions in PHP usually return string values for results regardless of the database's internal type.
Parameters:
getBeforeID [line 675]
int|MDB2_Error getBeforeID(
string
$table, [string
$field = null], [bool
$ondemand = true], [bool
$quote = true])
|
|
Returns the next free id of a sequence if the RDBMS does not support auto increment
Parameters:
getCol [line 438]
array|MDB2_Error getCol(
string
$query, [string
$type = null], [array
$params = array()], [array
$param_types = null], [int|string
$colnum = 0])
|
|
Fetch a single column from a result set and return it as an indexed array.
Parameters:
getOne [line 345]
scalar|MDB2_Error getOne(
string
$query, [string
$type = null], [array
$params = array()], [array
$param_types = null], [int|string
$colnum = 0])
|
|
Fetch the first column of the first row of data returned from a query. Takes care of doing the query and freeing the results when finished.
Parameters:
getRow [line 392]
array|MDB2_Error getRow(
string
$query, [array
$types = null], [array
$params = array()], [array
$param_types = null], [int
$fetchmode = MDB2_FETCHMODE_DEFAULT])
|
|
Fetch the first row of data returned from a query. Takes care of doing the query and freeing the results when finished.
Parameters:
limitQuery [line 273]
MDB2_Result|MDB2_Error limitQuery(
string
$query, array
$types, integer
$limit, [integer
$offset = 0], [string
$result_class = true], [mixed
$result_wrap_class = false])
|
|
Generates a limited query
Parameters:
Documentation generated on Mon, 11 Mar 2019 15:51:34 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|