📄 ij2.out
字号:
ij> -- this test shows some ij abilities against an active databasecreate table t (i int);0 rows inserted/updated/deletedij> insert into t values (3), (4);2 rows inserted/updated/deletedij> prepare s as 'select * from t';ij> execute s;I -----------3 4 ij> remove s;ij> -- now it won't find sexecute s;IJ ERROR: Unable to establish prepared statement Sij> prepare s as 'select * from t where i=?';ij> -- fails, needs parameterexecute s;ERROR 07000: At least one parameter to the current statement is uninitialized.ij> -- works, finds valueexecute s using 'values 3';IJ WARNING: Autocommit may close using result setI -----------3 ij> prepare t as 'values 3';ij> -- same as last executeexecute s using t;IJ WARNING: Autocommit may close using result setI -----------3 ij> -- same as last executeexecute 'select * from t where i=?' using 'values 3';IJ WARNING: Autocommit may close using result setI -----------3 ij> -- same as last executeexecute 'select * from t where i=?' using t;IJ WARNING: Autocommit may close using result setI -----------3 ij> -- param that is not needed gets out of range messageexecute 'select * from t where i=?' using 'values (3,4)';IJ WARNING: Autocommit may close using result setERROR XCL13: The parameter position '2' is out of range. The number of parameters for this prepared statement is '1'.ij> -- ignores rows that are not neededexecute 'select * from t where i=?' using 'values 3,4';IJ WARNING: Autocommit may close using result setI -----------3 ij> -- with autocommit off, extra rows are processed and no warning resultsautocommit off;ij> execute 'select * from t where i=?' using 'values 3,4';I -----------3 I -----------4 ij> execute 'select * from t where i=?' using 'values 3';I -----------3 ij> autocommit on;ij> -- will say params not set when no rows in using valuesexecute 'select * from t where i=?' using 'select * from t where i=9';IJ ERROR: Using clause had no resultsij> -- will say params not set when using values is not a queryexecute 'select * from t where i=?' using 'create table s (i int)';IJ ERROR: Using clause had no resultsij> -- note that the using part was, however, executed...drop table s;0 rows inserted/updated/deletedij> -- bug 5926 - make sure the using clause result set got closeddrop table t;0 rows inserted/updated/deletedij> create table t(c1 int);0 rows inserted/updated/deletedij> insert into t values(1);1 row inserted/updated/deletedij> execute 'select * from t where c1=?' using 'select * from t where c1=1';IJ WARNING: Autocommit may close using result setC1 -----------1 ij> drop table t;0 rows inserted/updated/deletedij> create table t(c1 int);0 rows inserted/updated/deletedij> insert into t values(1);1 row inserted/updated/deletedij> insert into t values(2);1 row inserted/updated/deletedij> execute 'select * from t where c1=?' using 'select * from t where c1>=1';IJ WARNING: Autocommit may close using result setC1 -----------1 ij> drop table t;0 rows inserted/updated/deletedij> -- show that long fields now don't take forever...create table t ( c char(50));0 rows inserted/updated/deletedij> insert into t values('hello');1 row inserted/updated/deletedij> select cast(c as varchar(20)) from t;1 --------------------hello ij> drop table t;0 rows inserted/updated/deletedij> -- show multiconnect ability; db name is wombat, reuse it...-- assumes ij.protocol is appropriately set...connect 'wombat' as wombat;ij(WOMBAT)> show connections;CONNECTION0 - jdbc:derby:wombatWOMBAT* - jdbc:derby:wombat* = current connectionij(WOMBAT)> set connection connection0;ij(CONNECTION0)> show connections;CONNECTION0* - jdbc:derby:wombatWOMBAT - jdbc:derby:wombat* = current connectionij(CONNECTION0)> set connection wombat;ij(WOMBAT)> disconnect;ij> show connections;CONNECTION0 - jdbc:derby:wombatNo current connectionij> set connection connection0;ij> show connections;CONNECTION0* - jdbc:derby:wombat* = current connectionij>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -