Timestamp的使用
编号:QA001017
建立日期: 1999年5月20日 最后修改日期:1999年5月20日
所属类别:
furis:
我看过《计算机世界》日报上刊登的PB讲座,上面提到用Timestamp作为数据库并发控制的工具。说只要表中有名为Timestamp的字段并且类型为Datetime, PB就会将其做为并发控制标志,每次读取此记录时在该字段中记录下此时时间,同时读取该字段,更新此记录时, 自动将该字段做为一个主键。我这样做时,发现PB并没有自动管理Timestamp字段。原因何在?
回答:
在 Sybase SQL Anywhere 中,Timestamp 是一个特殊的Column, 只有当参数 automatic_timestamp 为 On 时,Timestamp Column才会正常工作。而在 Sybase SQL Anywhere 中,参数 automatic_timestamp缺少值是 Off.可在 Sybase SQL Anywhere Interactive 中用set option public.automatic_timestamp = 'On' 来设置。
(在 Sybase SQL Anywhere ISQ 中未试过)可在 sys.sysoption Table或 sys.sysoptions View 中看到结果。更详细的信息见PB Online Book(找关键字 timestamp)。
此问题由cyclone回答。
| |
|
|
| |
|
|