* [ ] 功能
* 用于數據庫的鎖機制,如果在查詢或者執行操作的時候使用,高并發下,確保數據正確操作
* 用法: InnoDB where 條件在表主鍵值明確,且主鍵值存在的情況下,為**行級鎖**
* 如果主鍵where條件的主鍵查詢,**主鍵值不存在,則沒有鎖**
* 如果 where查詢條件中沒有主鍵,那么為**表級鎖**
* **MyISAM 類型都是表級鎖**
* 用法一:行級鎖
~~~
// account 表引擎為 InnoDB
// account 表主鍵為 uid
$wehre = [
'uid[in]' => [1, 2, ,3]
];
mysql\User::beg();
// 根據明確的主鍵值去查詢,且主鍵值,1,2, 3 存在,此次查詢為行級鎖,只會鎖定1,2,3這三行數據
$data = mysql\User::table('account')->lock( true )->where( $where )->select();
mysql\User::commit();
~~~
* 用法二:沒有鎖
~~~
// account 表引擎為 InnoDB
// account 表主鍵為 uid
$wehre = [
'username[in]' => [999999999,9999999]
];
mysql\User::beg();
// 根據主鍵去查詢,且主鍵值,99999,9999999記錄不存在存在,此次查詢為沒有鎖
$data = mysql\User::table('account')->lock( true )->where( $where )->select();
mysql\User::commit();
~~~
* 用法三:表級鎖
~~~
// account 表引擎為 InnoDB
// account 表主鍵為 uid
$wehre = [
'uid[like]' => 1,
];
mysql\User::beg();
// 根據主鍵值不明確的查詢,則為表級鎖
$data = mysql\User::table('account')->lock( true )->where( $where )->select();
mysql\User::commit();
~~~
- 開始使用
- 配置文件
- 路由模式
- AutoLoad類
- 啟動文件
- __construct
- SetRouting
- SetAlias
- SetStop
- SetError
- Access
- SetWorker
- SetClassFile
- SetClassDir
- Run
- OpenLoad
- LinuxStartAll
- Session類
- 使用說明
- set
- get
- delete
- pull
- has
- id
- Cookie類
- 使用說明
- set
- get
- delete
- pull
- has
- TempLets類
- 模板語法
- 模板標簽
- html
- show
- assign
- obtain
- Request類
- get
- post
- host
- referer
- getip
- localip
- header
- body
- file
- scheme
- protocolversion
- uri
- path
- querystring
- method
- Response
- SendFile
- FileStream
- SendData
- SetStatus
- SetHead
- SetMime
- WebSend
- redirect
- dumpJson
- dump
- come
- ps
- Frame類
- GetWeb
- ViewFile
- RoutingData
- SetClassFile
- SetClassDir
- GetMime
- FileMime
- LoadDir
- StartDir
- IsJson
- ArrJson
- JsonFormat
- ObStart
- GetConfig
- ConfigDir
- TempDir
- GetRunData
- GetStatic
- IsDebug
- SetDebug
- GetDebugInfo
- GlobalVariables類
- 使用說明
- set
- get
- delete
- pull
- has
- id
- Mysql類
- 新版本
- 第三方
- Thinkorm
- Medoo
- 舊版本
- Mysql 配置格式
- 項目中操作數據庫
- 項目場景
- 項目數據庫配置
- 項目數據庫中間類
- 項目中操作數據表
- 連貫操作
- where
- table
- data
- order
- field
- limit
- page
- group
- having
- join
- tabname
- union
- sql
- link
- link_base
- lock
- CURD 操作
- 寫入數據
- 數據刪除
- 數據查詢
- 數據更新
- 數據統計操作
- count
- sum
- max
- min
- avg
- 操作DEMO
- CurdTrait.php
- 項目Model層操作表.md
- Curl類
- Method類
- SslAes類
- layui_zqadmin