c-tree数据库(c-treeACE)(4):工具篇之三:一个不能用的工具

来源:互联网 发布:pc蛋蛋近三期的算法 编辑:程序博客网 时间:2024/05/16 05:59

表维护工具ctsqlutl,位于$CTREE_ROOT/tools/cmdline/admin/client
按照说明,该工具可以用于修改表名和字段名,用法也很简单。但如果你用了,那可能就遭殃了。
这里有很多问题:


(1)首先,修改表名的时候(把mytbl修改为yourtbl)提示让人摸不着头脑:
$./ctsqlutl -rentbl mytbl yourtbl -u ADMIN -a ADMIN -d ctreesql
Column '(null)' successfully renamed.


(2)执行这个命令后用isql进去看,发现select * from mytbl; 和 select * from yourtbl;都可以执行,内容相同。
但这个时候如果再去执行上面改名的命令,会提示mytbl不存在了:
$./ctsqlutl -rentbl mytbl yourtbl -u ADMIN -a ADMIN -d ctreesql
Fatal Error: Could not find table 'mytbl' owned by 'admin' in SQL dictionary.
但可从yourtbl改为mytbl:
$./ctsqlutl -rentbl yourtbl mytbl -u ADMIN -a ADMIN -d ctreesql
Column '(null)' successfully renamed.


(3)经过上面的步骤,在isql里面能查询mytbl, 也能查询yourtbl. 但是从系统表里面systables里面只能看 mytbl. 然后我们来删除yourtbl:
ISQL> drop table yourtbl;
drop table yourtbl;
ISQL> commit;
commit;
ISQL> drop table mytbl;
drop table mytbl;
drop table mytbl;
      *
error(-20005): Table/View/Synonym mytbl not found
此时文件系统中的数据文件已经被删除,但在systables里面却仍然有mytbl的记录。这样导致以后再也无法创建mytbl表了:
ISQL> create table mytbl(ee int);
create table mytbl(ee int);
create table mytbl(ee int);
             *
error(-20041): Table/View/Synonym mytbl already exists


(4)此时用最上面的表维护工具命令居然还可以执行:
$./ctsqlutl -rentbl mytbl yourtbl -u ADMIN -a ADMIN -d ctreesql
Column '(null)' successfully renamed.
系统表里面的表明改为yourtbl了。因此看起来ctsqlutl命令指示改了一下systables里面的表名而已。


(5)在isql里面将systables里面yourtbl的记录干掉:
ISQL> delete from systables where tbl = 'yourtbl';
delete from systables where tbl = 'yourtbl';
1 record deleted.
ISQL> commit;
commit;
记录确实没有了。 但是再执行:
$./ctsqlutl -rentbl mytbl yourtbl -u ADMIN -a ADMIN -d ctreesql
Column '(null)' successfully renamed.
要疯了。。。。。。。。。。。。。。。。不过,还有呢,简直让人不可思议的所谓世界100强公司的1/3在用的这个数据库。


(6)再次创建mytbl进而yourtbl,都能创建成功:
ISQL> create table yourtbl ( ee int);
create table yourtbl ( ee int);
ISQL> create table mytbl (ee int);
create table mytbl (ee int);
ISQL> commit;
commit;
系统表也正常,数据文件也都生成了。
此时再执行该工具:
./ctsqlutl -rentbl mytbl yourtbl -u ADMIN -a ADMIN -d ctreesql
Column '(null)' successfully renamed.
居然把系统表中mytbl修改为yourtbl,导致系统表里面同时有两条yourtbl的记录。
ISQL> select count(*) from systables where tbl='yourtbl';
select count(*) from systables where tbl='yourtbl';
    COUNT(*)
    --------
          2
1 record selected

 

崩溃,让人崩溃。
字段改名的功能,同样让人崩溃,不提也罢。

原创粉丝点击