首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏解Bug之路

    MySql-两阶段加锁协议 原

    考虑下面两种不同的扣减库存的方案: 方案1: begin; // 扣减库存 update t_inventory set count=count-5 where id=${id} and count > t_user_account where user_id=123 for update; // 插入订单记录 insert into t_trans; // 扣减库存 update t_inventory set count=count int count = select count from t_inventory for update; if count >= 5: update t_inventory set count=count -5 where id =123 commit else rollback 方案2: begin: int rows = update t_inventory set count=count

    2.3K40发布于 2018-08-14
  • 来自专栏半旧的技术栈

    【java筑基】面试必会的map集合

    R(3), "莫欺少年穷"); tm.put(new R(-5), "天下何人不识君"); tm.put(new R(9), "朋友一生一起走"); // {R[count

    38620编辑于 2022-10-26
领券