function |
function |
Db::table ($tablename) |
Gets the correct prefixed table name, transforms the database handle, |
DB::d elete ($tablename, condition, number of bars limit) |
Delete data from a table |
Db::insert ($tablename, data (array), whether to return the insertion ID, whether it is a replacement, whether silent) |
Inserting data operations |
Db::update ($tablename, data (array) condition) |
Update action |
Db::fetch (resource after query) |
Take an associative array from the result set, and note that if two or more columns in the result have the same field names, the last column takes precedence. |
Db::fetch_first ($sql) |
Fetching the first data fetch of the query |
Db::fetch_all ($sql) |
Query and Fetch |
Db::result_first ($sql) |
The first field value of a query result set |
Db::query ($sql) |
General Query |
Db::num_rows (resource after query) |
Get record lumped number |
Db::_execute (command, parameter) |
command to execute MySQL class |
Db::limit (N,n) |
Returns the restriction string |
Db::field (field name, $pid) |
Returns the in condition if an array is returned |
Db::order (alias, method) |
Sort |
Note: Due to the increased security detection of SQL in X1.5. So, if your SQL statement contains the function Load_file,hex,substring,if,ord,char at the beginning of the following. Or, the following operations are Intooutfile,intodumpfile,unionselect, (SELECT ') will be denied execution.
replace parameter |
function |
%t |
table name, |
%s |
string, if array is serialized |
%f |
format strings by %f style |
%d |
integer |
% i |
do not process |
%n |
If NULL is 0, if array, use ', ' to split, otherwise add quotation marks |
function |
function |
C::t ($tablename ')->count () |
Get all rows of a table |
C::t ($tablename ')->update (key value, $data) |
Update key Value data |
C::t ($tablename ')->delete (key value) |
Delete key value data |
C::t ($tablename ')->truncate () |
Clear table |
C::t ($tablename ')->insert ($data, $return _insert_id, $replace) |
Inserting data |
C::t ($tablename ')->fetch_all ($ids) |
Fetch data, which can be a single key value or multiple key-value arrays |
C::t ($tablename ')->fetch_all_field () |
Fetch all the field names table |
C::t ($tablename ')->range ($start, $limit, $sort) |
Fetch domain Range |
C::t ($tablename ')->optimize () |
Optimizing tables |
Original: http://wiki.blueidea.com/index.php?title=Discuz!X/Database Operation method
Bill: discuz! x/database operation methods, Db::table, C::t