| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 734 人关注过本帖
标题:网络解锁问题
只看楼主 加入收藏
wwg5252
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2013-8-20
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:9 
网络解锁问题
一个网络用户锁定表时,网络中断。其他网络用户如何对这个表进行解锁。
搜索更多相关主题的帖子: 网络 如何 用户 
2013-08-20 21:18
hu9jj
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:红土地
等 级:贵宾
威 望:400
帖 子:11857
专家分:43421
注 册:2006-5-13
收藏
得分:10 
服务器上应该有监控,当某个用户超过一定时间未进行操作就清除其所有的锁定。
收到的鲜花
  • wwg52522013-08-20 22:00 送鲜花  1朵  

活到老,学到老!http://www.(该域名已经被ISP盗卖了)E-mail:hu-jj@
2013-08-20 21:42
wwg5252
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2013-8-20
收藏
得分:0 
谢谢!服务器上需要怎样设置代码。
2013-08-20 22:03
qingfameng
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:35
帖 子:964
专家分:3019
注 册:2010-2-6
收藏
得分:3 
你可以试验一下:那张表是不是没有被破坏,而自动被关掉,并且解锁了,一切自然就明白了。
2013-08-21 00:34
wwg5252
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2013-8-20
收藏
得分:0 
就是不能解锁。
2013-08-21 07:21
wwg5252
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2013-8-20
收藏
得分:0 
不会自動解鎖。其他用户出现:“1705 不能存取文件。”
2013-08-21 12:20
wwg5252
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2013-8-20
收藏
得分:0 
请大师指教!
2013-08-21 18:11
qingfameng
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:35
帖 子:964
专家分:3019
注 册:2010-2-6
收藏
得分:3 
只有补救办法了2个:1、重新开通断网机子,把表关掉。2、但是如果不知道是哪台机子的故障,这种情况,只有重新启动主机服务器了。一般不会坏表,但也要预防。
2013-08-21 19:45
whinda
Rank: 6Rank: 6
等 级:贵宾
威 望:13
帖 子:253
专家分:418
注 册:2012-2-4
收藏
得分:4 
Looking at Locking
A long time I believed like so many others that Visual FoxPro uses the area beyond 2 GB for locking purposes. wOOdy was the first to point out to me that this isn't the case. He said that this fact further reduces the number of records in a table. So how does locking really work in Visual FoxPro?

The locking area starts at position 2,147,483,646 or 0x7FFFFFFE. Since positions start with 0, Visual FoxPro can make use of 0x7FFFFFFF bytes in a file. From that position the locking area grows down towards the beginning of the file. There's one byte in the locking area for each record.

As far as locking is concerned, Visual FoxPro treats the header as record number 0. This allows for using the same code for locking records as well as the header. Whenever Visual FoxPro updates the table header, it locks this byte first. Locking the header is required for adding a record. You can manually lock the header using

Lock("0",Alias())
The record lock bytes start at position 2,147,483,645 for record number 1 and go down from there. Hence, record number 2 is locked at 2,147,483,644, and so on. When Visual FoxPro locks a single record or the header, it only locks the corresponding byte.

FLOCK() locks the entire table. Technically, locking the table is identically to locking all records and the table header. If Visual FoxPro would only lock existing records this could lead to a raise condition. On one machine, Visual FoxPro would read the current number of records to determine which part of the locking area needs to be locked. After performing this calculation but before actually requesting the lock, another machine could add a new record. As a result, Visual FoxPro would either have to extent the locking area afterwards, or lock the table header before locking records.

Because that impacts performance, Visual FoxPro locks the highest possible number of records instead. The following expression returns the maximum number of records for any given table:

Int((2^31-Header()-2)/(Recsize()+1))
If you add more records than this to a table, you should either get an error message, or you would suffer from serious problems accessing the last records as they overlap with their own locking area. I haven't yet tested what happens in this case. Visual FoxPro starts locking at position:

2^31 - 1 - Int((2^31-Header()-2)/(Recsize()+1))

锁定表时为每个表分配了2G的缓冲,表的锁定也是在这个2G的缓冲中实现的,锁定一条记录就锁定缓冲中对应的一个字节。但这个缓冲是设在哪个地方的就不太清楚了,应该是每一台访问的客户端都有,如果因断网而导致这种情况的话,个人认为只能所有客户端重启了,这样才能清除缓冲区。如果可能的话,不重启就得清空缓冲区。

[ 本帖最后由 whinda 于 2013-8-21 20:03 编辑 ]
2013-08-21 19:59
wwg5252
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2013-8-20
收藏
得分:0 
谢谢各位大侠!,过一段较长时间后,能自动解锁。
2013-08-21 20:45
快速回复:网络解锁问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.047251 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved