duanpai9945 2010-12-10 04:50
浏览 35
已采纳

PHP中的Java同步概念

Condition

I have comma separated list of airway bill numbers in a record in table core_config_data. This table uses engine Innodb.

I have a class with a function to take read this record, explode it, unshift one airway bill number, implode rest and save in database again.

Problem

When 2 or more people press assign airway bill number at same instance, all the shipment get same airway bill numbers.

Question

Is there a way in php / magento / zend to implement synchronized for this kind of situation.

Regards, Saurabh

  • 写回答

2条回答 默认 最新

  • dptj13337 2010-12-10 05:07
    关注

    You can use locks, but I suggest to create a table for airway bill numbers.

    SELECT counter_field FROM child_codes FOR UPDATE;
    UPDATE child_codes SET counter_field = counter_field + 1;
    

    http://dev.mysql.com/doc/refman/5.0/en/innodb-locking-reads.html

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?