<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                **\think\Db的__callStatic方法調用自身的connect方法獲得config配置對應的驅動數據庫實例,如:** 繼承至Connection類的 `\think\db\connector\Mysql` ### **舉例:** `\think\Db::table('think_user'); `則解析為 `self::connect()->table('think_user')` 再次解析為 `new \think\db\builder\Mysql()->table('think_user'); ` //而table方法是Query.php里的 //這個Query類是什么時候怎么加載上的? //Connection.php有個__construct 和 __call //當調用Mysql(Connection)類里的不存在的方法時__call調動getQuery實例化獲取新的查詢對象 而實例化的類是__construct時獲取的 //即Db::table實際調用的是Query類的table方法 ***** ~~~ Db: static connect($config = [], $name = false) [Connection] 調用的是Connection下的connect方法 static clear() [void] 清除連接實例 connector/Mysql extends Connection: getFields($tableName) [array] 取得數據表的字段信息 getTables($dbName = '')[array] 取得數據庫的表信息 Connection: getBuilder()[array] 獲取當前連接器類對應的Builder類 fieldCase($info_arr)[array] 對返數據表字段信息進行大小寫轉換出來 getConfig($config = '')[mixed] 獲取數據庫的配置參數 setConfig($config, $value = '')[void] 設置數據庫的配置參數 connect(array $config = [], $linkNum = 0, $autoConnection = false)[PDO] 連接數據庫方法 free()[???] 釋放查詢結果 getPdo()[PDO|false] 獲取PDO對象 query($sql, $bind = [], $master = false, $pdo = false)[mixed] 執行查詢 返回數據集 execute($sql, $bind = [], Query $query = null)[int] 執行語句 getRealSql($sql, array $bind = [])[string] 根據參數綁定組裝最終的SQL語句 便于調試 transaction($callback)[mixed] 執行數據庫事務 startTrans()[bool|mixed] 啟動事務 commit()[void] 用于非自動提交狀態下面的查詢提交 rollback()[void] 事務回滾 batchQuery($sqlArray = [], $bind = [], Query $query = null)[boolean] 批處理執行SQL語句 批處理的指令都認為是execute操作 getQueryTimes($execute = false)[integer] 獲得查詢次數 getExecuteTimes()[integer] 獲得執行次數 close()[Connection自身] 關閉數據庫(或者重新連接) getLastSql()[string] 獲取最近一次查詢的sql語句 getLastInsID($sequence = null)[string] 獲取最近插入的ID getNumRows()[integer] 獲取返回或者影響的記錄數 getError()[string] 獲取最近的錯誤信息 quote($str, $master = true)[string] SQL指令安全過濾 listen($callback)[void] 監聽SQL執行 Query類 Query類屬性:只能內部及子類調用,無需關心 Query類方法 getConnection()[Connection類] 獲取當前的數據庫Connection對象 connect($config)[Query] 切換當前的數據庫連接 getModel()[Model|null] 獲取當前的模型對象實例 readMaster($allTable = false)[void] 設置后續從主庫讀取數據 getBuilder()[Builder類] 獲取當前的builder實例對象 name($name)[Query] 指定默認的數據表名(不含前綴) setTable($table)[Query] 指定默認數據表名(含前綴) getTable($name = '')[string] 得到當前或者指定名稱的數據表 parseSqlTable($sql)[string] 將SQL語句中的__TABLE_NAME__字符串替換成帶前綴的表名(小寫) query($sql, $bind = [], $master = false, $class = false)[mixed] 執行查詢 返回數據集 xecute($sql, $bind = [])[int] 執行語句 getLastInsID($sequence = null)[string] 獲取最近插入的ID getLastSql()[string][string] 獲取最近一次查詢的sql語句 transaction($callback)[mixed] 執行數據庫事務 startTrans()[void] 啟動事務 commit()[void] 用于非自動提交狀態下面的查詢提交 rollback()[void] 事務回滾 batchQuery($sql = [], $bind = [])[boolean] 批處理執行SQL語句 批處理的指令都認為是execute操作 getConfig($name = '')[boolean] 獲取數據庫的配置參數 getPartitionTableName($data, $field, $rule = [])[string] 得到分表的的數據表名 value($field, $default = null, $force = false)[mixed] 得到某個字段的值 column($field, $key = '索引')[array] 得到某個列的數組 count($field = '*')[integer|string] COUNT查詢 aggregate($aggregate, $field, $force = false)[mixed] 聚合查詢 sum($field)[float|int] SUM查詢 min($field, $force = true)[mixed] MIN查詢 max($field, $force = true)[mixed] MAX查詢 avg($field)[float|int] AVG查詢 setField($field, $value = '')[integer] 設置記錄的某個字段值 支持使用數據庫字段和方法 setInc($field, $step = 1, $lazyTime = 0)[integer|true] 字段值(延遲)增長 setDec($field, $step = 1, $lazyTime = 0)[integer|true] 字段值(延遲)減少 join($join, $condition = null, $type = 'INNER')[Query] 查詢SQL組裝 join union($union, $all = false)[Query] 查詢SQL組裝 union field($field, $except = false, $tableName = '', $prefix = '', $alias = '')[Query] 指定查詢字段 支持字段排除和指定數據表 fieldRaw($field, array $bind = [])[Query] 表達式方式指定查詢字段 data($field, $value = null)[Query] 設置數據 inc($field, $step = 1)[Querey] 字段值增長 dec($field, $step = 1)[Querey] 字段值減少 exp($field, $value)[Query] 使用表達式設置數據 raw($value)[Expression] 使用表達式設置數據 view($join, $field = true, $on = null, $type = 'INNER')[Query] 指定JOIN查詢字段 //例子 \think\Db::table('sky_user a')->view('sky_user b','username,password',"a.uid=b.uid",'INNER')->select(); //等同于 \think\Db::table(['sky_user'=>"a"])->view(['sky_user'=>"b"],['username'=>"u","password"],"a.uid=b.uid",'INNER')->select(); partition($data, $field, $rule = [])[Query] 設置分表規則 where($field, $op = null, $condition = null)[Query] 指定AND查詢條件 whereOr($field, $op = null, $condition = null)[Query] 指定OR查詢條件 whereXor($field, $op = null, $condition = null)[Query] 指定XOR查詢條件 whereRaw($where, $bind = [], $logic = 'AND')[Query] 指定表達式查詢條件 whereOrRaw($where, $bind = [])[Query] 指定表達式查詢條件 OR whereNull($field, $logic = 'AND')[Query] 指定Null查詢條件 whereNotNull($field, $logic = 'AND')[Query] 指定NotNull查詢條件 whereIn($field, $condition, $logic = 'AND')[Query] 指定In查詢條件 whereNotIn($field, $condition, $logic = 'AND')[Query] 指定NotIn查詢條件 whereLike($field, $condition, $logic = 'AND')[Query] 指定Like查詢條件 whereNotLike($field, $condition, $logic = 'AND')[Query] 指定NotLike查詢條件 whereBetween($field, $condition, $logic = 'AND')[Query] 指定Between查詢條件 whereNotBetween($field, $condition, $logic = 'AND')[Query] 指定NotBetween查詢條件 whereExp($field, $condition, $logic = 'AND')[Query] 指定Exp查詢條件 useSoftDelete($field, $condition = null)[Query] 設置軟刪除字段及條件 removeWhereField($field, $logic = 'AND')[Query] 去除某個查詢條件 removeOption($option = true)[Query] 去除查詢參數 limit($offset, $length = null)[Query] 指定查詢數量 page($page, $listRows = null)[Query] 指定分頁 $config =[ 'page'=>1,//當前頁 'path'=>1,//url路徑 'query'=>1,//url額外參數 'fragment'=>1,//url錨點 'var_page'=>1,//分頁變量 'list_rows'=>1,//每頁數量 'type'=>1,//分頁類名 ]; paginate($listRows = null, $simple = false, $config = [])[\think\Paginator] 分頁查詢 table($table)[Query] 指定當前操作的數據表 using($using)[Query] SING支持 用于多表刪除 order($field, $order = null)[Query] 指定排序 order('id','desc') 或者 order(['id'=>'desc','create_time'=>'desc']) orderRaw($field, array $bind = [])[Query] 表達式方式指定Field排序 cache($key = true, $expire = null, $tag = null)[Query] 查詢緩存 group($group)[Query] 指定group查詢 having($having)[Query] 指定having查詢 lock($lock = false)[Query] 指定查詢lock(是否lock) distinct($distinct)[Query] 指定distinct查詢(是否唯一) alias($alias)[Query] 指定數據表別名 orce($force)[Query] 指定強制索引 fetchSql($fetch = true)[Query] 獲取執行的SQL語句 fetchPdo($pdo = true)[Query] 不主動獲取數據集 master()[Query] 設置從主服務器讀取數據 strict($strict = true)[Query] 設置是否嚴格檢查字段名 failException($fail = true)[Query] 設置查詢數據不存在是否拋出異常 sequence($sequence = null)[Query] 設置自增序列名 pk($pk)[Query] 指定數據表主鍵 whereTime($field, $op, $range = null)[Query] 查詢日期或者時間 getTableInfo($tableName = '', $fetch = '')[mixed] 獲取數據表信息 getPk($options = '')[string|array] 獲取當前數據表的主鍵 getTableFields($table = '')[??] 獲取當前數據表字段信息 getFieldsType($table = '')[??] 獲取當前數據表字段類型 getFieldsBind($table = '')[??] 獲取當前數據表綁定信息 bind($key, $value = false, $type = PDO::PARAM_STR)[Query] 參數綁定 isBind($key)[boolean] 檢測參數是否已經綁定 options(array $options)[Query] 查詢參數賦值 getOptions($name = '')[mixed] 獲取當前的查詢參數 with($with)[Query] 設置關聯查詢JOIN預查詢 withCount($relation, $subQuery = true)[Query] 關聯統計 withField($field)[Query] 關聯預加載中 獲取關聯指定字段值 via($via = '')[Query] 設置當前字段添加的表別名 relation($relation)[Query] 設置關聯查詢 insert(array $data = [], $replace = false, $getLastInsID = false, $sequence = null)[integer|string] 插入記錄 insertGetId(array $data, $replace = false, $sequence = null)[integer|string] 插入記錄并獲取自增ID insertAll(array $dataSet, $replace = false, $limit = null)[integer|string] 批量插入記錄 selectInsert($fields, $table)[integer|string] 通過Select方式插入記錄 update(array $data = [])[integer|string] 更新記錄 getPdo()[\PDOStatement|string] 執行查詢但只返回PDOStatement對象 select($data = null)[Collection|false|\PDOStatement|string] 查找記錄 find($data = null)[array|false|\PDOStatement|string|Model] 查找單條記錄 selectOrFail($data = null)[array|\PDOStatement|string|Model] 查找多條記錄 如果不存在則拋出異常 findOrFail($data = null)[array|\PDOStatement|string|Model] 查找單條記錄 如果不存在則拋出異常 chunk($count, $callback, $column = null, $order = 'asc')[boolean] 分批數據返回處理 getBind()[array] 獲取綁定的參數 并清空 buildSql($sub = true)[string] 創建子查詢SQL delete($data = null)[int] 刪除記錄 static event($event, $callback)[void] 注冊回調方法 ~~~ builder及其子類是負責組裝sql的如:`\library\think\db\builder\Mysql.php`,每個Query最終執行方法都會用到它 如Query的inser方法里就有t` $bulk = $this->builder->insert($data, $options);`這個屬于tp內部使用的平時我們用不到
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看