EC-CUBE
Public メソッド
クラス MDB2_Extended
MDB2_Extendedに対する継承グラフ
Inheritance graph
[凡例]
MDB2_Extendedのコラボレーション図
Collaboration graph
[凡例]

Public メソッド

 autoPrepare ($table, $table_fields, $mode=MDB2_AUTOQUERY_INSERT, $where=false, $types=null, $result_types=MDB2_PREPARE_MANIP)
autoExecute ($table, $fields_values, $mode=MDB2_AUTOQUERY_INSERT, $where=false, $types=null, $result_class=true, $result_types=MDB2_PREPARE_MANIP)
 buildManipSQL ($table, $table_fields, $mode, $where=false)
limitQuery ($query, $types, $limit, $offset=0, $result_class=true, $result_wrap_class=false)
 execParam ($query, $params=array(), $param_types=null)
 getOne ($query, $type=null, $params=array(), $param_types=null, $colnum=0)
 getRow ($query, $types=null, $params=array(), $param_types=null, $fetchmode=MDB2_FETCHMODE_DEFAULT)
 getCol ($query, $type=null, $params=array(), $param_types=null, $colnum=0)
 getAll ($query, $types=null, $params=array(), $param_types=null, $fetchmode=MDB2_FETCHMODE_DEFAULT, $rekey=false, $force_array=false, $group=false)
 getAssoc ($query, $types=null, $params=array(), $param_types=null, $fetchmode=MDB2_FETCHMODE_DEFAULT, $force_array=false, $group=false)
 executeMultiple (&$stmt, $params=null)
 getBeforeID ($table, $field=null, $ondemand=true, $quote=true)
 getAfterID ($id, $table, $field=null)

関数

& autoExecute ( table,
fields_values,
mode = MDB2_AUTOQUERY_INSERT,
where = false,
types = null,
result_class = true,
result_types = MDB2_PREPARE_MANIP 
)

Generate an insert, update or delete query and call prepare() and execute() on it

引数:
stringname of the table
arrayassoc ($key=>$value) where $key is a field name and $value its value
inttype of query to build MDB2_AUTOQUERY_INSERT MDB2_AUTOQUERY_UPDATE MDB2_AUTOQUERY_DELETE MDB2_AUTOQUERY_SELECT
string(in case of update and delete queries, this string will be put after the sql WHERE statement)
arraythat contains the types of the placeholders
stringwhich specifies which result class to use
mixedarray that contains the types of the columns in the result set or MDB2_PREPARE_RESULT, if set to MDB2_PREPARE_MANIP the query is handled as a manipulation query
戻り値:
bool|MDB2_Error true on success, a MDB2 error on failure
参照:
buildManipSQL
autoPrepare public
autoPrepare ( table,
table_fields,
mode = MDB2_AUTOQUERY_INSERT,
where = false,
types = null,
result_types = MDB2_PREPARE_MANIP 
)

Generate an insert, update or delete query and call prepare() on it

引数:
stringtable
arraythe fields names
inttype of query to build MDB2_AUTOQUERY_INSERT MDB2_AUTOQUERY_UPDATE MDB2_AUTOQUERY_DELETE MDB2_AUTOQUERY_SELECT
string(in case of update and delete queries, this string will be put after the sql WHERE statement)
arraythat contains the types of the placeholders
mixedarray that contains the types of the columns in the result set or MDB2_PREPARE_RESULT, if set to MDB2_PREPARE_MANIP the query is handled as a manipulation query
戻り値:
resource handle for the query
参照:
buildManipSQL public
buildManipSQL ( table,
table_fields,
mode,
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 !
引数:
stringname of the table
orderedarray containing the fields names
inttype of query to build MDB2_AUTOQUERY_INSERT MDB2_AUTOQUERY_UPDATE MDB2_AUTOQUERY_DELETE MDB2_AUTOQUERY_SELECT
string(in case of update and delete queries, this string will be put after the sql WHERE statement)
戻り値:
string sql query for prepare() public
execParam ( query,
params = array(),
param_types = null 
)

Execute a parameterized DML statement.

引数:
stringthe SQL query
arrayif supplied, prepare/execute will be used with this array as execute parameters
arraythat contains the types of the values defined in $params
戻り値:
int|MDB2_Error affected rows on success, a MDB2 error on failure public
executeMultiple ( &$  stmt,
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.

引数:
resourcequery handle from prepare()
arraynumeric array containing the data to insert into the query
戻り値:
bool|MDB2_Error true on success, a MDB2 error on failure public
参照:
prepare(), execute()
getAfterID ( id,
table,
field = null 
)

Returns the autoincrement ID if supported or $id

引数:
mixedvalue as returned by getBeforeId()
stringname of the table into which a new row was inserted
stringname of the field into which a new row was inserted
戻り値:
int|MDB2_Error id on success, a MDB2 error on failure public
getAll ( query,
types = null,
params = array(),
param_types = null,
fetchmode = MDB2_FETCHMODE_DEFAULT,
rekey = false,
force_array = false,
group = false 
)

Fetch all the rows returned from a query.

引数:
stringthe SQL query
arraythat contains the types of the columns in the result set
arrayif supplied, prepare/execute will be used with this array as execute parameters
arraythat contains the types of the values defined in $params
intthe fetch mode to use
boolif set to true, the $all will have the first column as its first dimension
bool$force_arrayused only when the query returns exactly two columns. If true, the values of the returned array will be one-element arrays instead of scalars.
bool$groupif true, the values of the returned array is wrapped in another array. If the same key value (in the first column) repeats itself, the values will be appended to this array instead of overwriting the existing values.
戻り値:
array|MDB2_Error data on success, a MDB2 error on failure public
getAssoc ( query,
types = null,
params = array(),
param_types = null,
fetchmode = MDB2_FETCHMODE_DEFAULT,
force_array = false,
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.

引数:
stringthe SQL query
arraythat contains the types of the columns in the result set
arrayif supplied, prepare/execute will be used with this array as execute parameters
arraythat contains the types of the values defined in $params
bool$force_arrayused only when the query returns exactly two columns. If TRUE, the values of the returned array will be one-element arrays instead of scalars.
bool$groupif TRUE, the values of the returned array is wrapped in another array. If the same key value (in the first column) repeats itself, the values will be appended to this array instead of overwriting the existing values.
戻り値:
array|MDB2_Error data on success, a MDB2 error on failure public
getBeforeID ( table,
field = null,
ondemand = true,
quote = true 
)

Returns the next free id of a sequence if the RDBMS does not support auto increment

引数:
stringname of the table into which a new row was inserted
stringname of the field into which a new row was inserted
boolwhen true the sequence is automatic created, if it not exists
boolif the returned value should be quoted
戻り値:
int|MDB2_Error id on success, a MDB2 error on failure public
getCol ( query,
type = null,
params = array(),
param_types = null,
colnum = 0 
)

Fetch a single column from a result set and return it as an indexed array.

引数:
stringthe SQL query
stringthat contains the type of the column in the result set
arrayif supplied, prepare/execute will be used with this array as execute parameters
arraythat contains the types of the values defined in $params
int|stringwhich column to return
戻り値:
array|MDB2_Error data on success, a MDB2 error on failure public
getOne ( query,
type = null,
params = array(),
param_types = null,
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.

引数:
stringthe SQL query
stringthat contains the type of the column in the result set
arrayif supplied, prepare/execute will be used with this array as execute parameters
arraythat contains the types of the values defined in $params
int|stringwhich column to return
戻り値:
scalar|MDB2_Error data on success, a MDB2 error on failure public
getRow ( query,
types = null,
params = array(),
param_types = null,
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.

引数:
stringthe SQL query
arraythat contains the types of the columns in the result set
arrayif supplied, prepare/execute will be used with this array as execute parameters
arraythat contains the types of the values defined in $params
intthe fetch mode to use
戻り値:
array|MDB2_Error data on success, a MDB2 error on failure public
& limitQuery ( query,
types,
limit,
offset = 0,
result_class = true,
result_wrap_class = false 
)

Generates a limited query

引数:
stringquery
arraythat contains the types of the columns in the result set
integerthe numbers of rows to fetch
integerthe row to start to fetching
stringwhich specifies which result class to use
mixedstring which specifies which class to wrap results in
戻り値:
MDB2_Result|MDB2_Error result set on success, a MDB2 error on failure public

このクラスの説明は次のファイルから生成されました:
 全て データ構造 ネームスペース 関数 変数