发表于: 2006.07.08 03:52
分类: TIMESTEN
出处: http://yangtingkun.itpub.net/post/468/131063
---------------------------------------------------------------
Timesten的PASSTHROUGH功能很强,Timesten的PASSTHROUGH提供了从0到3的4个等级,下面简单分析这4个不同的等级。
Passthrough的等级除了可以在DSN中设置,也可以直接在TTISQL中通过命令设置,不过前提是关闭自动COMMIT。
F:>ttisql passthrough
Copyright (c) 1996-2006, Oracle. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
All commands must end with a semicolon character.
connect "DSN=passthrough";
Connection successful: DSN=passthrough;UID=YANGTINGKUN;DataStore=F:TIMESTENSTO
REPASSTHROUGHPASSTHROUGH;DRIVER=C:WINDOWSSystem32ttdv60.dll;OracleId=TEST1
;PermSize=20;TempSize=20;PassThrough=3;
(Default setting AutoCommit=1)
Command> autocommit 0;
Command> passthrough 0;
PASSTHROUGH 0意味着关闭PASSTHROUGH功能。
Command> select * from tab;
2206: Table YANGTINGKUN.TAB not found
The command failed.
Command> passthrough 1;
Command> select * from tab;
< T, TABLE, <NULL> >
< T2, TABLE, <NULL> >
< TT_02_7391_L, TABLE, <NULL> >
< TT_02_AGENT_STATUS, TABLE, <NULL> >
< TT_02_SYNC_OBJS, TABLE, <NULL> >
< TT_02_USER_COUNT, TABLE, <NULL> >
6 rows found.
设置了PASSTHROUGH等于1,则对于Timesten中不存在的表,会将SQL传到Oracle去执行。
Command> insert into t2 select rownum from tab;
2206: Table YANGTINGKUN.TAB not found
The command failed.
Command>
Command> insert into t values (7, 'ab');
8225: Table T is read only
The command failed.
Command> passthrough 2;
Command> insert into t values (7, 'ab');
1 row inserted.
Command> commit;
PASSTHROUGH等于2就是在PASSTHROUGH 1的基础上增加了只读表的判断。
Command> create table t2 (id int);
Command> insert into t2 values (1);
1 row inserted.
Command> select * from t2;
< 1 >
1 row found.
Command> passthrough 3;
Command> select * from t2;
5221: Oracle syntax error in OCIStmtExecute(): ORA-00942: ? rc = -1
The command failed.
Command> create table t2 (id number);
Command> select * from t2;
0 rows found.
如果设置了PASSTHROUGH等于3,则不管是DDL还是DML,甚至是查询,都会将SQL发到Oracle中执行。即使访问的对象在timesten数据库中存在,而在Oracle中不存在。











