Php database-PHP source code

Source: Internet
Author: User
Ec (2); & nbsp; + callback & nbsp; * @ parammixed $ where data & nbsp; & nbsp; * @ paramstring $ tab script ec (2); script

+ ----------------------------------------------------------
* @ Param mixed $ where data
* @ Param string $ tables data table name
* @ Param string $ fields field name
* @ Param string $ order sorting
* @ Param string $ limit
* @ Param string $ group
* @ Param string $ having
* @ Param boolean $ whether the cache is cached
* @ Param boolean $ lazy indicates whether to load the data asynchronously.
* @ Param boolean $ whether lock is locked
+ ----------------------------------------------------------
* @ Return ArrayObject
+ ----------------------------------------------------------
* @ Throws ThinkExecption
+ ----------------------------------------------------------
*/
Public function find ($ where, $ tables, $ fields = '*', $ order = null, $ limit = null, $ group = null, $ having = null, $ join = null, $ cache = false, $ lazy = false, $ lock = false)
{
If (in_array ($ this-> getDbType (), array ('mssql', 'ibase '), true )){
$ This-> queryStr = 'select'. $ this-> parseLimit ($ limit)
. $ This-> parseFields ($ fields)
. 'From'. $ tables
. $ This-> parseJoin ($ join)
. $ This-> parseWhere ($ where)
. $ This-> parseGroup ($ group)
. $ This-> parseHaving ($ having)
. $ This-> parseOrder ($ order );
} Else {
$ This-> queryStr = 'select'. $ this-> parseFields ($ fields)
. 'From'. $ tables
. $ This-> parseJoin ($ join)
. $ This-> parseWhere ($ where)
. $ This-> parseGroup ($ group)
. $ This-> parseHaving ($ having)
. $ This-> parseOrder ($ order );
If ("ORACLE" = $ this-> getDbType ())
If ($ limit [0] <= 0 ){
If ($ limit [1]> 0)
$ This-> queryStr = "SELECT * FROM (". $ this-> queryStr. ") where rownum <=". $ limit [1];
} Else {
$ WhereClause = "";
If ($ limit [1]> 0)
$ WhereClause = "where rownum <=". ($ limit [0] + $ limit [1]);

$ This-> queryStr = "SELECT * FROM (select row _. *, ROWNUM _ FROM ("
. $ This-> queryStr. ") ROW _"
. $ WhereClause
. ") Where rownum _>"
. $ Limit [0];
}
Else
$ This-> queryStr. = $ this-> parseLimit ($ limit );
}
Return $ this-> query ('', $ cache, $ lazy, $ lock );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.