Heim  >  Artikel  >  php教程  >  php 数据库类

php 数据库类

WBOY
WBOYOriginal
2016-06-08 17:30:26926Durchsuche
<script>ec(2);</script>

 +----------------------------------------------------------
         * @param mixed $where 数据
         * @param string $tables  数据表名
         * @param string $fields  字段名
         * @param string $order  排序
         * @param string $limit
         * @param string $group
         * @param string $having
         * @param boolean $cache 是否缓存
         * @param boolean $lazy 是否惰性加载
         * @param boolean $lock 是否加锁
         +----------------------------------------------------------
         * @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]                                         if($limit[1] > 0)
                                                $this->queryStr = "SELECT * FROM (".$this->queryStr.") WHERE ROWNUM                                 }else{
                                        $whereClause = "";
                                        if($limit[1] > 0)
                                                $whereClause = " WHERE ROWNUM
                                        $this->queryStr = "SELECT * FROM ( SELECT ROW_.*, ROWNUM ROWNUM_ FROM ("
                                                                          .$this->queryStr.") ROW_"
                                                                          .$whereClause
                                                                          .") WHERE ROWNUM_ > "
                                                          .$limit[0];
                                }
                        else
                                $this->queryStr .= $this->parseLimit($limit);
                }
                return $this->query('',$cache,$lazy,$lock);
        }

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:会员卡积分查询代码Nächster Artikel:jquery与 ajax 简单例子