day90 下單 事務中隔離級別帶來的問題

2022-07-20 05:06:10 字數 900 閱讀 7501

read uncommitted --->不做任何隔離,具有髒讀,不可重複讀,幻讀等問題

read committed ---->可以防止髒讀,不能防止不可重複讀,幻讀等問題

repeatable read ---->可以防止髒讀,不可重複讀,不能防止幻讀(mysql預設的隔離級別)

serializable ---> 都可以防止

乙個事務能讀取到另乙個事務還未提交的資料

age=16

a---->18 (把16改成18 但是沒有提交),但是a 回滾了

b---->讀取的時候 age=18 然後做了業務操作 一旦a回滾了業務就有問題了

乙個事務讀取到另乙個事務已經提交的資料

age=16

a--->18 把16改成了18 並提交

b--->當a 提交後 b是能讀取到18的

乙個事務讀取到另外乙個事務新增或刪除的資料

mysql的配置檔案

修改:set @@global.tx_isolation='read-committed';

檢視:select @@global.tx_isolation;

他不是鎖,他覺得資料是安全的,沒有資料和我搶,但是最後做校驗

查詢 age=16 條件是 where id=1

age=16+1

update where id=1 and age=16 update age=17

他就是鎖 他的態度是悲觀的 我覺得有人會動資料 所以在查詢的時候就鎖起來

select age from user where id=1 for update

user.object.select_for_update(id=1).first()

微信APP統一下單

一 下單方法 param params 下單引數 public function unifiedorder params result this xml to data response if empty result result code empty result err code return...

微信統一下單 非同步通知介面

注意 該鏈結 不能攜帶引數 有些php框架預設的路由形式是帶有引數的,如 index.php?r site index,這樣也會導致返回失敗。class wxpay else echo json encode arr private function send prepaycurl xmldata ...

微信支付之前的統一下單

1.客戶下單,該單據儲存在自己的庫存中 1.統一下單介面講解 統一下單介面 欄位名變數名 必填型別 示例值描述 公眾賬號id 是string 32 wxd678efh567hg6787 商戶號mch id 是string 32 1230000109 裝置號device info 否string 32...