[-]
[+]
|
Changed |
cego.changes
|
|
[-]
[+]
|
Changed |
cego.spec
^
|
|
[-]
[+]
|
Deleted |
cego-2.10.2.tar.bz2/gates/A.sql~
^
|
@@ -1,1231 +0,0 @@
---
--- ### Gate A
---
---
-
-create table t_int ( a int );
-create table t_string ( a string(30));
-create table t_datetime ( a datetime);
-create table t_long ( a long);
-create table t_bool ( a bool);
-create table t_bigint ( a bigint(10));
-create table t_float ( a float);
-create table t_double ( a double);
-create table t_decimal ( a decimal(2));
-create table t_fixed ( a fixed(2));
-create table t_smallint ( a smallint);
-create table t_tinyint ( a tinyint);
-create table t_null ( a int);
-
-create table t_fk1 ( primary a int not null, b int );
-create table t_fk2 ( primary c int not null, a int );
-alter table t_fk2 add foreign key fk1 ( a ) references t_fk1 ( a );
-
-create table t_ta ( a int, b string(30));
-create table t_sfu ( a int, b string(30));
-create table t_upd ( a int, b string(30));
-create table t_ins ( a int, b string(30));
-
-create table t_ibs1 ( a int, b string(30));
-create table t_ibs2 ( a int, b string(30));
-
-create table t_strfunc ( a int, b string(30), c datetime, d float, e string(10));
-
-create table t_nv1 ( primary a int not null, b string(30));
-create table t_nv2 ( primary c int not null, d string(30));
-create table t_nv3 ( primary e int not null, f string(30));
-create table t_nv4 ( primary g int not null, h string(30));
-create index t4_idx on t_nv4(h);
-
-create view v_nv1 as select tx.a as a, ty.d as d from t_nv1 tx, t_nv2 ty where tx.a = ty.c;
-create view v_nv2 as select tx.a as a, ty.e as e from v_nv1 tx, t_nv3 ty where tx.a = ty.e;
-
-create table t_oj1 ( primary a int not null, b string(30));
-create table t_oj2 ( primary c int not null, d string(30));
-
-create view v_oj1 as select t_oj1.a as A, t_oj2.d as B from t_oj1 inner join t_oj2 on t_oj1.a = t_oj2.c;
-
-create table t_cwc ( a int, b string(30));
-
-create table t_supplier ( primary snr int not null, sname string(30), prio int);
-create table t_material ( primary mnr int not null, mname string(30), snr int);
-create table t_orders (primary onr int not null, mname string(30), orderdate datetime, cnr int);
-
-@
-create procedure checkType ( t in string(30) ) return string(10)
-begin
-
- if :t = 'int'
- then
- var i int;
- delete from t_int;
- insert into t_int values ( 1 );
-
- cursor intCur as select a from t_int;
- if fetch intCur into ( :i ) = true
- then
- if :i = 1
- then
- return 'ok';
- else
- return 'error';
- end;
- else
- return 'error';
- end;
- elsif :t = 'string'
- then
- var s string(30);
- delete from t_string;
- insert into t_string values ( 'XXX' );
-
- cursor strCur as select a from t_string;
- if fetch strCur into ( :s ) = true
- then
- if :s = 'XXX'
- then
- return 'ok';
- else
- return 'error';
- end;
- else
- return 'error';
- end;
- elsif :t = 'datetime'
- then
- var d datetime;
- var s string(30);
-
- delete from t_datetime;
- insert into t_datetime values ( date('%d.%m.%Y %H:%M:%S','01.01.2006 1:11:00'));
-
- cursor dtCur as select date2str(a, '%d.%m.%Y') from t_datetime;
- if fetch dtCur into ( :s ) = true
- then
- if :s = '01.01.2006'
- then
- return 'ok';
- else
- return 'error';
- end;
- else
- return 'error';
- end;
- elsif :t = 'long'
- then
- var l long;
-
- delete from t_long;
- insert into t_long values ( (long)11111111111 );
-
- cursor dtCur as select a from t_long;
- if fetch dtCur into ( :l ) = true
- then
- if :l = (long)11111111111
- then
- return 'ok';
- else
- return 'error';
- end;
- else
- return 'error';
- end;
- elsif :t = 'bool'
- then
- var b bool;
-
- delete from t_bool;
- insert into t_bool values ( true );
-
- cursor boolCur as select a from t_bool;
- if fetch boolCur into ( :b ) = true
- then
- if :b = true
- then
- return 'ok';
- else
- return 'error';
- end;
- else
- return 'error';
- end;
- elsif :t = 'bigint'
- then
- var b bigint(10);
-
- delete from t_bigint;
- insert into t_bigint values ( (bigint)12345678 );
-
- cursor biCur as select a from t_bigint;
- if fetch biCur into ( :b ) = true
- then
- if :b = (bigint)12345678
- then
- return 'ok';
- else
- return 'error';
- end;
- else
- return 'error';
- end;
- elsif :t = 'float'
- then
- var f float;
-
- delete from t_float;
- insert into t_float values ( 12.34 );
-
- cursor floatCur as select a from t_float;
- if fetch floatCur into ( :f ) = true
- then
- if :f = 12.34
- then
- return 'ok';
- else
- return 'error';
- end;
- else
- return 'error';
- end;
- elsif :t = 'double'
- then
- var d double;
-
- delete from t_double;
- insert into t_double values ( (double)12.34 );
-
- cursor doubleCur as select a from t_double;
- if fetch doubleCur into ( :d ) = true
- then
- if :d = (double)12.34
- then
- return 'ok';
- else
- return 'error';
- end;
- else
- return 'error';
- end;
- elsif :t = 'decimal'
- then
- var d decimal(2);
-
- delete from t_decimal;
- insert into t_decimal values ( (decimal)12.34 );
-
- cursor decimalCur as select a from t_decimal;
- if fetch decimalCur into ( :d ) = true
- then
- if :d = (decimal)12.34
- then
- return 'ok';
- else
- return 'error';
- end;
- else
- return 'error';
- end;
- elsif :t = 'fixed'
- then
- var f fixed(2);
-
- delete from t_fixed;
- insert into t_fixed values ( (fixed)12.34 );
-
- cursor fixedCur as select a from t_fixed;
- if fetch fixedCur into ( :f ) = true
- then
- if :f = (fixed)12.34
- then
- return 'ok';
- else
- return 'error';
- end;
- else
- return 'error';
- end;
- elsif :t = 'smallint'
- then
- var s smallint;
-
- delete from t_smallint;
- insert into t_smallint values ( (smallint)3 );
-
- cursor siCur as select a from t_smallint;
- if fetch siCur into ( :s ) = true
- then
- if :s = (smallint)3
- then
- return 'ok';
- else
- return 'error';
- end;
- else
- return 'error';
- end;
-
- elsif :t = 'tinyint'
- then
- var t tinyint;
-
- delete from t_tinyint;
- insert into t_tinyint values ( (tinyint)123 );
-
- cursor tiCur as select a from t_tinyint;
- if fetch tiCur into ( :t ) = true
- then
- if :t = (tinyint)123
- then
- return 'ok';
- else
- return 'error';
- end;
- else
- return 'error';
- end;
- elsif :t = 'null'
- then
- var n int;
-
- insert into t_null values ( null );
-
- cursor nullCur as select a from t_null;
- if fetch nullCur into ( :n ) = true
- then
- if :n = null
- then
- return 'ok';
- else
- return 'error';
- end;
- else
- return 'error';
- end;
-
- else
- return 'error';
- end;
-
-end;
-@
-
-@
-create procedure checkNull () return string(10)
-begin
-
- var i int;
- delete from t_int;
- insert into t_int values ( null );
- insert into t_int values ( 1 );
-
- cursor nullCur as select a from t_int where a is null;
- if fetch nullCur into ( :i ) = true
- then
-
- if :i != null
- then
- return 'error';
- end;
- if :i is not null
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- cursor intCur as select a from t_int where a is not null;
- if fetch intCur into ( :i ) = true
- then
- if :i != 1
- then
- return 'error';
- end;
- else
- return 'error';
- end;
- return 'ok';
-end;
-@
-
-@
-create procedure checkForeignKey() return string(20)
-begin
-
- insert into t_fk1 values ( 1, 2 );
- insert into t_fk1 values ( 2, 1 );
-
- begin
- insert into t_fk2 values ( 2, 1 );
- exception when any
- then
- return 'error';
- end;
-
- begin
- insert into t_fk2 values ( 1, 111 );
- return 'error';
- exception when any
- then
- noop;
- end;
-
- begin
- delete from t_fk1 where a = 1;
- return 'error';
- exception when any
- then
- noop;
- end;
-
- begin
- delete from t_fk1 where a = 2;
- exception when any
- then
- return 'error';
- end;
-
- return 'ok';
-end;
-@
-
-@
-create procedure checkTransaction() return string(20)
-begin
- delete from t_ta;
-
- start transaction;
- insert into t_ta values ( 1, 'alpha' );
- commit;
-
- start transaction;
- insert into t_ta values ( 2, 'beta' );
- rollback;
-
- var i int;
- cursor taCur as select a from t_ta where b = 'alpha';
- if fetch taCur into ( :i ) = true
- then
- if :i != 1
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- cursor rbCur as select a from t_ta where b = 'beta';
- if fetch taCur into ( :i ) = true
- then
- return 'error';
- end;
-
- return 'ok';
-
-end;
-@
-
-@
-create procedure checkSelectForUpdate () return string(20)
-begin
-
- delete from t_sfu;
- insert into t_sfu values ( 1, 'X' );
-
- begin
- var val int;
- update t_sfu set a = a + 1 where b = 'X' return :val = a;
- if :val = 2
- then
- return 'ok';
- else
- return 'error';
- end;
- exception when any
- then
- return 'error';
- end;
-end;
-@
-
-@
-create procedure checkDistinct() return string(20)
-begin
-
- delete from t_int;
- insert into t_int values ( 1 );
- insert into t_int values ( 1 );
- insert into t_int values ( 1 );
- insert into t_int values ( 2 );
- insert into t_int values ( 2 );
- insert into t_int values ( 3 );
-
- begin
- var i int;
- var c int;
-
- :c = 0;
- cursor disCur as select distinct a from t_int;
- while fetch disCur into ( :i ) = true
- begin
- :c = :c + 1;
- end;
-
-
-
- if :c = 3
- then
- return 'ok';
- else
- return 'error' | :c;
- end;
- exception when any
- then
- return 'error';
- end;
-end;
-@
-
-
-@
-create procedure checkInsert ( numIns in int ) return string(20)
-begin
-
- begin
-
- var actIns int;
-
- :actIns = 0;
-
- while :actIns < :numIns
- begin
- insert into t_ins values ( :actIns , 'XXX');
- :actIns = :actIns + 1;
- end;
-
- return 'ok';
-
- exception when any
- then
- return 'error';
- end;
-
-end;
-@
-
-@
-create procedure checkUpdate ( id in string(30), numUpd in int ) return string(20)
-begin
-
-
- insert into t_upd values ( 1 , 'Alpha');
- insert into t_upd values ( 1 , 'Beta');
- insert into t_upd values ( 1 , 'Gamma');
- insert into t_upd values ( 1 , 'Delta');
-
- begin
-
- var actUpd int;
-
- :actUpd = 0;
-
- while :actUpd < :numUpd
- begin
- update t_upd set a = a + 1 where b = :id;
- :actUpd = :actUpd + 1;
- end;
- return 'ok';
-
- exception when any
- then
- return 'error';
- end;
-end;
-@
-
-@
-create procedure checkInsertBySelect () return string(20)
-begin
-
- delete from t_ibs1;
- delete from t_ibs2;
-
- insert into t_ibs1 values ( 1, 'X' );
- insert into t_ibs1 values ( 2, 'X' );
- insert into t_ibs1 values ( 3, 'X' );
- insert into t_ibs1 values ( 4, 'X' );
- insert into t_ibs1 values ( 5, 'X' );
-
- begin
-
- insert into t_ibs2 select a, b from t_ibs1;
- return 'ok';
-
- exception when any
- then
- return 'error';
- end;
-end;
-@
-
-@
-create procedure checkStringFunctions() return string(20)
-begin
-
- insert into t_strfunc values ( 1 , 'abXXXbb', date('%d.%m.%Y %H:%M:%S','01.01.2006 2:23:00'), 3.44, '42');
-
- var s string(10);
- var i int;
- var l long;
-
- cursor trimCur as select trim ( b, 'abc' ) from t_strfunc;
- if fetch trimCur into ( :s ) = true
- then
- if :s != 'XXX'
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close trimCur;
-
- cursor truncCur as select trunc ( d ) from t_strfunc;
- if fetch truncCur into ( :i ) = true
- then
- if :i != 3
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close truncCur;
-
- cursor d2sCur as select date2str(c, '%Y%m%d') from t_strfunc;
- if fetch d2sCur into ( :s ) = true
- then
- if :s != '20060101'
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close d2sCur;
-
- cursor lowCur as select lower(b) from t_strfunc;
- if fetch lowCur into ( :s ) = true
- then
- if :s != 'abxxxbb'
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close lowCur;
-
- cursor upCur as select upper(b) from t_strfunc;
- if fetch upCur into ( :s ) = true
- then
- if :s != 'ABXXXBB'
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close upCur;
-
-
- cursor leftCur as select left(b, 3) from t_strfunc;
- if fetch leftCur into ( :s ) = true
- then
- if :s != 'abX'
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close leftCur;
-
- cursor rightCur as select right(b, 3) from t_strfunc;
- if fetch rightCur into ( :s ) = true
- then
- if :s != 'Xbb'
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close rightCur;
-
- cursor gp1Cur as select getpos(b, 'b') from t_strfunc;
- if fetch gp1Cur into ( :i ) = true
- then
- if :i != 2
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close gp1Cur;
-
- cursor gp2Cur as select getpos(b, 'b', 3, 1) from t_strfunc;
- if fetch gp2Cur into ( :i ) = true
- then
- if :i != 6
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close gp2Cur;
-
- cursor gp3Cur as select getpos(b, 'b', 3, 2) from t_strfunc;
- if fetch gp3Cur into ( :i ) = true
- then
- if :i != 7
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close gp3Cur;
-
-
- cursor sub1Cur as select substr(b, 2) from t_strfunc;
- if fetch sub1Cur into ( :s ) = true
- then
- if :s != 'bXXXbb'
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close sub1Cur;
-
- cursor sub2Cur as select substr(b, 2, 1) from t_strfunc;
- if fetch sub2Cur into ( :s ) = true
- then
- if :s != 'b'
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close sub2Cur;
-
- cursor repCur as select replace(b, 'XXX', 'YYY') from t_strfunc;
- if fetch repCur into ( :s ) = true
- then
- if :s != 'abYYYbb'
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close repCur;
-
- cursor lenCur as select length(b) from t_strfunc;
- if fetch lenCur into ( :i ) = true
- then
- if :i != 7
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close lenCur;
-
- cursor s2iCur as select str2int(e) from t_strfunc;
- if fetch s2iCur into ( :i ) = true
- then
- if :i != 42
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close s2iCur;
-
- cursor s2lCur as select str2long(e) from t_strfunc;
- if fetch s2lCur into ( :l ) = true
- then
- if :l != (long)42
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close s2lCur;
-
-
- cursor rsCur as select randstr(10) from t_strfunc;
- if fetch rsCur into ( :s ) = true
- then
- noop;
- else
- return 'error';
- end;
-
- close rsCur;
-
- cursor riCur as select randint(1000) from t_strfunc;
- if fetch riCur into ( :i ) = true
- then
- noop;
- else
- return 'error';
- end;
-
- close riCur;
-
- return 'ok';
-
-end;
-@
-
-@
-create procedure checkNestedView() return string(20)
-begin
-
- var i int;
-
- delete from t_nv1;
- delete from t_nv2;
- delete from t_nv3;
- delete from t_nv4;
-
- insert into t_nv1 values ( 1, 'xxx');
- insert into t_nv1 values ( 2, 'yyy');
- insert into t_nv1 values ( 3, 'zzz');
-
- insert into t_nv2 values ( 1, 'xxx');
- insert into t_nv2 values ( 2, 'III');
- insert into t_nv2 values ( 3, 'OOOO');
-
- insert into t_nv3 values ( 1, 'Iwan');
- insert into t_nv3 values ( 2, 'xxx');
- insert into t_nv3 values ( 3, 'hurga');
-
-
- insert into t_nv4 values ( 1, 'alpha');
- insert into t_nv4 values ( 2, 'beta');
- insert into t_nv4 values ( 3, 'gamma');
- insert into t_nv4 values ( 4, 'delta');
-
-
- cursor nvCur as select v_nv2.a from v_nv2 v2, t_nv4 where v2.a = t_nv4.g and t_nv4.h = 'beta';
- if fetch nvCur into ( :i ) = true
- then
- if :i != 2
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close nvCur;
-
- return 'ok';
-
-end;
-@
-
-
-@
-create procedure checkOuterJoin() return string(20)
-begin
-
- var i int;
-
-
- insert into t_oj1 values ( 1, 'xxx');
- insert into t_oj1 values ( 2, 'RRR');
- insert into t_oj1 values ( 4, 'yyy');
-
- insert into t_oj2 values ( 1, 'xxx');
- insert into t_oj2 values ( 2, 'vvv');
- insert into t_oj2 values ( 3, 'zzz');
-
-
- cursor oj1Cur as select a from t_oj1 inner join t_oj2 on t_oj1.a = t_oj2.c;
- if fetch oj1Cur into ( :i ) = true
- then
- if :i != 1
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close oj1Cur;
-
- cursor oj2Cur as select a from t_oj1 left outer join t_oj2 on t_oj1.a = t_oj2.c;
- if fetch oj2Cur into ( :i ) = true
- then
- if :i != 1
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close oj2Cur;
-
-
- cursor oj3Cur as select a from t_oj1 tx right outer join t_oj2 ty on tx.a = ty.c;
- if fetch oj3Cur into ( :i ) = true
- then
- if :i != 1
- then
- return 'error3';
- end;
- else
- return 'error';
- end;
-
- close oj3Cur;
-
- cursor oj4Cur as select A from v_oj1 where B = 'xxx';
- if fetch oj4Cur into ( :i ) = true
- then
- if :i != 1
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close oj4Cur;
-
- return 'ok';
-end;
-@
-
-@
-create procedure checkCaseWhen() return string(20)
-begin
-
- var s string(10);
-
- insert into t_cwc values ( 1, 'xxx');
- insert into t_cwc values ( 1, 'ggg');
- insert into t_cwc values ( 4, 'yyy');
- insert into t_cwc values ( 3, 'zzz');
-
- cursor cwcCur as select case when tx.a = 1 then 'alpha' else 'beta' end from t_cwc tx;
- if fetch cwcCur into ( :s ) = true
- then
- if :s != 'alpha'
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close cwcCur;
-
- return 'ok';
-end;
-@
-
-@
-create procedure checkSubSelect() return string(20)
-begin
-
- delete from t_supplier;
- delete from t_material;
- delete from t_orders;
-
-
- -- insert base data
- insert into t_supplier values ( 1, 'Time&Material', 3);
- insert into t_supplier values ( 2, 'Cego AG', 5);
- insert into t_supplier values ( 3, 'Moon Factory', 9);
- insert into t_supplier values ( 4, 'McDagobert', 3);
- insert into t_supplier values ( 11, 'HAL', 2);
- insert into t_supplier values ( 12, 'Abraxas', 1);
- insert into t_supplier values ( 13, 'ThunderStorm', 9);
-
- insert into t_material values ( 1, 'screw', 11);
- insert into t_material values ( 2, 'nail', 11);
- insert into t_material values ( 3, 'hammer', 1);
- insert into t_material values ( 4, 'saw', 2);
- insert into t_material values ( 5, 'nail', 2);
- insert into t_material values ( 6, 'knife', 1);
- insert into t_material values ( 7, 'screw', 2);
- insert into t_material values ( 8, 'saw', 11);
- insert into t_material values ( 9, 'hammer', 11);
-
- insert into t_orders values ( 4711, 'screw', sysdate, 23);
- insert into t_orders values ( 4712, 'nail', sysdate, 23);
- insert into t_orders values ( 4713, 'saw', sysdate, 23);
- insert into t_orders values ( 4714, 'hammer', sysdate, 23 );
-
- var s string(10);
-
- cursor subCur as select sname from t_supplier sup where not exists
- ( select * from t_orders ord where not exists
- ( select * from t_material mat where mat.snr = sup.snr and mat.mname = ord.mname ));
-
-
- if fetch subCur into ( :s ) = true
- then
- if :s != 'HAL'
- then
- return 'error';
- end;
- else
- return 'error';
- end;
-
- close subCur;
-
- return 'ok';
-end;
-@
-
-@
-create procedure checkGrouping() return string(20)
-begin
-
- delete from t_material;
-
- insert into t_material values ( 1, 'screw', 11);
- insert into t_material values ( 2, 'nail', 11);
- insert into t_material values ( 3, 'hammer', 1);
- insert into t_material values ( 4, 'saw', 2);
- insert into t_material values ( 5, 'nail', 2);
- insert into t_material values ( 6, 'knife', 1);
- insert into t_material values ( 7, 'screw', 2);
- insert into t_material values ( 8, 'saw', 11);
- insert into t_material values ( 9, 'hammer', 11);
- insert into t_material values ( 10, 'saw', 1);
-
- var s string(10);
- var i int;
-
- cursor groupCur as select mname, count(*) from t_material group by mname;
-
- while fetch groupCur into ( :s, :i ) = true
- begin
- if :s = 'screw' and :i != 2
- then
- return 'error';
- end;
- if :s = 'nail' and :i != 2
- then
- return 'error';
- end;
- if :s = 'hammer' and :i != 2
- then
- return 'error';
- end;
- if :s = 'saw' and :i != 3
- then
- return 'error';
- end;
-
-
- end;
-
- close groupCur;
-
- cursor havCur as select mname, count(*) from t_material group by mname having count(*) = 3;
-
- if fetch havCur into ( :s, :i ) = true
- then
- if :s != 'saw'
- then
- return 'error';
- end;
- end;
-
- close havCur;
-
- return 'ok';
-end;
-@
-
-@
-create procedure checkAgg() return string(20)
-begin
-
- delete from t_material;
-
- insert into t_material values ( 1, 'screw', 11);
- insert into t_material values ( 2, 'nail', 11);
- insert into t_material values ( 3, 'hammer', 1);
- insert into t_material values ( 4, 'saw', 2);
- insert into t_material values ( 5, 'nail', 2);
- insert into t_material values ( 6, 'knife', 1);
- insert into t_material values ( 7, 'screw', 2);
- insert into t_material values ( 8, 'saw', 11);
- insert into t_material values ( 9, 'hammer', 11);
- insert into t_material values ( 10, 'saw', 1);
-
- var i int;
-
- cursor aggCur as select count(*) from t_material;
-
- if fetch aggCur into ( :i ) = true
- then
- if :i != 10
- then
- return 'error';
- end;
- end;
-
- return 'ok';
-end;
-@
-
-
-:r = call checkType('int');
-insert into checklog values ('A', 'Integer type check', :r);
-:r = call checkType('string');
-insert into checklog values ('A', 'String type check', :r);
-:r = call checkType('datetime');
-insert into checklog values ('A', 'Datetime type check', :r);
-:r = call checkType('long');
-insert into checklog values ('A', 'Long type check', :r);
-:r = call checkType('bool');
-insert into checklog values ('A', 'Bool type check', :r);
-:r = call checkType('bigint');
-insert into checklog values ('A', 'Bigint type check', :r);
-:r = call checkType('float');
-insert into checklog values ('A', 'Float type check', :r);
-:r = call checkType('double');
-insert into checklog values ('A', 'Double type check', :r);
-:r = call checkType('decimal');
-insert into checklog values ('A', 'Decimal type check', :r);
-:r = call checkType('fixed');
-insert into checklog values ('A', 'Fixed type check', :r);
-:r = call checkType('smallint');
-insert into checklog values ('A', 'Small int type check', :r);
-:r = call checkType('tinyint');
-insert into checklog values ('A', 'Tiny int type check', :r);
-:r = call checkType('null');
-insert into checklog values ('A', 'Null type check', :r);
-:r = call checkNull();
-insert into checklog values ('A', 'Null check', :r);
-:r = call checkForeignKey();
-insert into checklog values ('A', 'Foreign key check', :r);
-:r = call checkTransaction();
-insert into checklog values ('A', 'Transaction check', :r);
-:r = call checkSelectForUpdate();
-insert into checklog values ('A', 'Select for update check', :r);
-:r = call checkDistinct();
-insert into checklog values ('A', 'Distinct check', :r);
-:r = call checkInsert(100);
-insert into checklog values ('A', 'Insert check', :r);
-:r = call checkUpdate('beta', 100);
-insert into checklog values ('A', 'Update check', :r);
-:r = call checkInsertBySelect();
-insert into checklog values ('A', 'Insert by select check', :r);
-:r = call checkStringFunctions();
-insert into checklog values ('A', 'String functions check', :r);
-:r = call checkNestedView();
-insert into checklog values ('A', 'Nested view check', :r);
-:r = call checkOuterJoin();
-insert into checklog values ('A', 'Outer join check', :r);
-:r = call checkCaseWhen();
-insert into checklog values ('A', 'Case when check', :r);
-:r = call checkSubSelect();
-insert into checklog values ('A', 'Subselect check', :r);
-:r = call checkGrouping();
-insert into checklog values ('A', 'Grouping check', :r);
-:r = call checkAgg();
-insert into checklog values ('A', 'Aggregation check', :r);
-
-
-drop procedure checkType;
-drop procedure checkNull;
-drop procedure checkForeignKey;
-drop procedure checkTransaction;
-drop procedure checkSelectForUpdate;
-drop procedure checkDistinct;
-drop procedure checkInsert;
-drop procedure checkUpdate;
-drop procedure checkInsertBySelect;
-drop procedure checkStringFunctions;
-drop procedure checkNestedView;
-drop procedure checkOuterJoin;
-drop procedure checkCaseWhen;
-drop procedure checkSubSelect;
-drop procedure checkGrouping;
-drop procedure checkAgg;
-
-
-drop view v_nv1;
-drop view v_nv2;
-drop view v_oj1;
-
-
-drop table t_int;
-drop table t_string;
-drop table t_datetime;
-drop table t_long;
-drop table t_bool;
-drop table t_bigint;
-drop table t_float;
-drop table t_double;
-drop table t_decimal;
-drop table t_fixed;
-drop table t_smallint;
-drop table t_tinyint;
-drop table t_null;
-drop table t_fk1;
-drop table t_fk2;
-drop table t_ta;
-drop table t_sfu;
-drop table t_upd;
-drop table t_ins;
-drop table t_ibs1;
-drop table t_ibs2;
-drop table t_strfunc;
-drop table t_nv1;
-drop table t_nv2;
-drop table t_nv3;
-drop table t_nv4;
-drop table t_oj1;
-drop table t_oj2;
-drop table t_cwc;
-drop table t_supplier;
-drop table t_orders;
-drop table t_material;
\ No newline at end of file
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/README
^
|
@@ -4,7 +4,7 @@
----
A relational and transactional database system
- Version 2.10.2
+ Version 2.10.4
(C)opyright 2006,2007,2008,2009,2010,2011 by Bjoern Lemke
|
[-]
[+]
|
Added |
cego-2.10.4.tar.bz2/gates/C.sql
^
|
@@ -0,0 +1,192 @@
+--
+-- ### Gate C
+--
+--
+
+
+create table t1 ( primary a int not null, b string(30) );
+create table t2 ( primary c int not null, d string(30));
+
+insert into t1 values ( 1, 'hugo');
+insert into t1 values ( 2, 'hugo');
+insert into t1 values ( 3, 'walter');
+insert into t1 values ( 4, 'bert');
+insert into t1 values ( 5, 'bert');
+insert into t1 values ( 6, 'bert');
+insert into t1 values ( 7, 'bert');
+insert into t1 values ( 8, 'bert');
+insert into t1 values ( 9, 'bert');
+insert into t1 values ( 10, 'bert');
+
+
+insert into t2 values ( 1, 'hugo');
+insert into t2 values ( 2, 'hugo');
+insert into t2 values ( 3, 'walter');
+insert into t2 values ( 4, 'bert');
+insert into t2 values ( 5, 'bert');
+insert into t2 values ( 16, 'bert');
+insert into t2 values ( 17, 'bert');
+insert into t2 values ( 18, 'bert');
+insert into t2 values ( 19, 'bert');
+insert into t2 values ( 20, 'bert');
+
+@
+create procedure checkSelect001(msg out string(20)) return string(10)
+begin
+ var res string(10) = 'error';
+ var i int;
+
+ cursor xCur as select count(*) from t1 inner join t2 on t1.a = t2.c;
+ if fetch xCur into ( :i ) = true
+ then
+ if :i = 5
+ then
+ :res = 'ok';
+ end;
+ end;
+ close xCur;
+
+ :msg = 'Inner join check';
+
+ return :res;
+end;
+@
+
+@
+create procedure checkSelect002(msg out string(20)) return string(10)
+begin
+ var res string(10) = 'error';
+ var i int;
+
+ cursor xCur as select count(*) from t1 left outer join t2 on t1.a = t2.c;
+ if fetch xCur into ( :i ) = true
+ then
+ if :i = 10
+ then
+ :res = 'ok';
+ end;
+ end;
+ close xCur;
+
+ :msg = 'Left outer join check';
+
+ return :res;
+end;
+@
+
+
+@
+create procedure checkSelect003(msg out string(20)) return string(10)
+begin
+ var res string(10) = 'error';
+ var i int;
+
+ cursor xCur as select count(*) from t1 left outer join t2 on t1.a = t2.c;
+
+ if fetch xCur into ( :i ) = true
+ then
+ if :i = 10
+ then
+ :res = 'ok';
+ end;
+ end;
+ close xCur;
+
+ :msg = 'Right outer join check';
+
+ return :res;
+end;
+@
+
+
+@
+create procedure checkSelect004(msg out string(20)) return string(10)
+begin
+ var res string(10) = 'error';
+ var i int;
+
+ cursor xCur as select count(*) from t1 inner join t2 on t1.a = t2.c where a = 5 or a = 1;
+
+ if fetch xCur into ( :i ) = true
+ then
+ if :i = 2
+ then
+ :res = 'ok';
+ end;
+ end;
+ close xCur;
+
+ :msg = 'Inner join check with condition';
+
+ return :res;
+end;
+@
+
+
+@
+create procedure checkSelect005(msg out string(20)) return string(10)
+begin
+ var res string(10) = 'error';
+ var i int;
+
+ cursor xCur as select count(*) from t1 left outer join t2 on t1.a = t2.c where a = 10;
+
+ if fetch xCur into ( :i ) = true
+ then
+ if :i = 1
+ then
+ :res = 'ok';
+ end;
+ end;
+ close xCur;
+
+ :msg = 'Left join check with condition';
+
+ return :res;
+end;
+@
+
+@
+create procedure checkSelect006(msg out string(20)) return string(10)
+begin
+ var res string(10) = 'error';
+ var i int;
+
+ cursor xCur as select count(*) from t1 right outer join t2 on t1.a = t2.c where c = 10;
+
+ if fetch xCur into ( :i ) = true
+ then
+ if :i = 1
+ then
+ :res = 'ok';
+ end;
+ end;
+ close xCur;
+
+ :msg = 'Left join check with condition';
+
+ return :res;
+end;
+@
+
+
+:r = call checkSelect001(:msg);
+insert into checklog values ('C', :msg, :r);
+:r = call checkSelect002(:msg);
+insert into checklog values ('C', :msg, :r);
+:r = call checkSelect003(:msg);
+insert into checklog values ('C', :msg, :r);
+:r = call checkSelect004(:msg);
+insert into checklog values ('C', :msg, :r);
+:r = call checkSelect005(:msg);
+insert into checklog values ('C', :msg, :r);
+
+drop procedure checkSelect001;
+drop procedure checkSelect002;
+drop procedure checkSelect003;
+drop procedure checkSelect004;
+drop procedure checkSelect005;
+
+drop table t1;
+drop table t2;
+
|
[-]
[+]
|
Added |
cego-2.10.4.tar.bz2/gates/C.sql~
^
|
@@ -0,0 +1,265 @@
+--
+-- ### Gate B
+--
+--
+
+
+create table kids ( primary kid int not null, forename string(30), gender string(10), birthday datetime, gid int);
+create table kidtoys ( primary tid int not null, toyname string(30));
+
+create table toy2kid ( primary tid int not null, primary kid int not null);
+
+create table kidgroup ( primary gid int not null, groupname string(20));
+
+create view kidview as select k.forename as forename, kg.groupname as groupname from kids k, kidgroup kg where k.gid = kg.gid;
+
+create view kidtoyview as select k.forename as forename, kt.toyname as toyname from kids k, kidtoys kt, toy2kid t2k
+ where k.kid = t2k.kid and t2k.tid = kt.tid;
+
+
+insert into kidgroup values ( 1, 'LittleGeeks');
+insert into kidgroup values ( 2, 'FunnyBunny');
+
+insert into kids values ( 1, 'hugo' , 'boy', date('%d.%m.%Y %H:%M:%S', '12.01.2001 07:53:12'), 1);
+insert into kids values ( 2, 'john', 'boy', date('%d.%m.%Y %H:%M:%S', '01.07.2002 07:53:12'), 1);
+insert into kids values ( 3, 'kuno', 'boy', date('%d.%m.%Y %H:%M:%S', '19.03.2003 07:53:12'), 1);
+insert into kids values ( 4, 'peter', 'boy', date('%d.%m.%Y %H:%M:%S', '23.05.2001 07:53:12'), 1);
+insert into kids values ( 5, 'karl', 'boy', date('%d.%m.%Y %H:%M:%S', '25.07.2005 07:53:12'), 2);
+insert into kids values ( 6, 'dieter', 'boy', date('%d.%m.%Y %H:%M:%S', '09.08.2003 07:53:12'), 2);
+insert into kids values ( 7, 'iwan', 'boy', date('%d.%m.%Y %H:%M:%S', '12.03.2002 07:53:12'), 2);
+insert into kids values ( 8, 'eugen', 'boy', date('%d.%m.%Y %H:%M:%S', '11.05.2001 07:53:12'), 2);
+insert into kids values ( 9, 'norbert', 'boy', date('%d.%m.%Y %H:%M:%S', '14.08.2002 07:53:12'), 2);
+insert into kids values ( 10, 'rudi', 'boy', date('%d.%m.%Y %H:%M:%S', '04.07.2005 07:53:12'), 2);
+insert into kids values ( 11, 'detlev', 'boy', date('%d.%m.%Y %H:%M:%S', '02.01.2007 07:53:12'), 2);
+insert into kids values ( 12, 'frank', 'boy', date('%d.%m.%Y %H:%M:%S', '12.02.2005 07:53:12'), 2);
+insert into kids values ( 13, 'anna', 'girl', date('%d.%m.%Y %H:%M:%S', '14.02.2003 07:53:12'), 1);
+insert into kids values ( 14, 'berta', 'girl', date('%d.%m.%Y %H:%M:%S', '14.08.2002 07:53:12'), 1);
+insert into kids values ( 15, 'olga', 'girl', date('%d.%m.%Y %H:%M:%S', '14.12.2003 07:53:12'), 2);
+insert into kids values ( 16, 'sveta', 'girl', date('%d.%m.%Y %H:%M:%S', '14.11.2004 07:53:12'), 2);
+insert into kids values ( 17, 'maria', 'girl', date('%d.%m.%Y %H:%M:%S', '12.01.2002 07:53:12'), 2);
+insert into kids values ( 18, 'anna', 'girl', date('%d.%m.%Y %H:%M:%S', '01.02.2008 07:53:12'), 2);
+
+
+insert into kidtoys values ( 1, 'car');
+insert into kidtoys values ( 2, 'train');
+insert into kidtoys values ( 3, 'brick');
+insert into kidtoys values ( 4, 'skateboard');
+insert into kidtoys values ( 5, 'ball');
+
+
+insert into toy2kid values ( 1, 1);
+insert into toy2kid values ( 1, 3);
+insert into toy2kid values ( 2, 6);
+insert into toy2kid values ( 2, 12);
+insert into toy2kid values ( 2, 7);
+insert into toy2kid values ( 3, 11);
+insert into toy2kid values ( 3, 10);
+insert into toy2kid values ( 3, 1);
+insert into toy2kid values ( 4, 10);
+insert into toy2kid values ( 5, 9);
+
+insert into toy2kid values ( 1, 13);
+insert into toy2kid values ( 2, 13);
+insert into toy2kid values ( 3, 13);
+insert into toy2kid values ( 4, 13);
+insert into toy2kid values ( 5, 13);
+
+@
+create procedure checkSelect001(msg out string(20)) return string(10)
+begin
+ var res string(10) = 'error';
+ var i int;
+
+ cursor xCur as select count(*) from kids where kid > 5;
+ if fetch xCur into ( :i ) = true
+ then
+ if :i = 13
+ then
+ :res = 'ok';
+ end;
+ end;
+ close xCur;
+
+ :msg = 'Number of kids where kid > 5';
+
+ return :res;
+end;
+@
+
+@
+create procedure checkSelect002(msg out string(20)) return string(10)
+begin
+ var res string(10) = 'error';
+ var i int;
+
+ cursor xCur as select count(*) from kids where kid >= 5;
+ if fetch xCur into ( :i ) = true
+ then
+ if :i = 14
+ then
+ :res = 'ok';
+ end;
+ end;
+ close xCur;
+
+ :msg = 'Number of kids where kid >= 5';
+
+ return :res;
+end;
+@
+
+
+@
+create procedure checkSelect003(msg out string(20)) return string(10)
+begin
+ var res string(10) = 'error';
+ var f string(10);
+
+ cursor xCur as
+ select forename from kids where forename in ( select forename from kidview where groupname = 'LittleGeeks' )
+ and gender = 'boy' or ( date2str(birthday, '%Y') < '2001' and date2str(birthday, '%m') = '07' );
+
+ if fetch xCur into ( :f ) = true
+ then
+ if :f = 'john'
+ then
+ :res = 'ok';
+ end;
+ end;
+ close xCur;
+
+ :msg = 'Kid with special birtday';
+
+ return :res;
+end;
+@
+
+
+@
+create procedure checkSelect004(msg out string(20)) return string(10)
+begin
+ var res string(10) = 'error';
+ var g1 string(10);
+ var g2 string(10);
+ var i1 int;
+ var i2 int;
+
+ var b bool;
+
+ --
+ -- select kids grouped by gender
+ --
+
+ cursor xCur as
+ select gender, count(*) from kids group by gender order by gender;
+ :b = fetch xCur into ( :g1, :i1 );
+ :b = fetch xCur into ( :g2, :i2 );
+ close xCur;
+
+ if :g1 = 'boy' and :i1 = 12 and :g2 = 'girl' and :i2 = 6
+ then
+ :res = 'ok';
+ end;
+
+ :msg = 'Grouped kids order by gender';
+
+ return :res;
+end;
+@
+
+
+@
+create procedure checkSelect005(msg out string(20)) return string(10)
+begin
+ var res string(10) = 'error';
+ var g1 string(10);
+ var g2 string(10);
+ var i1 int;
+ var i2 int;
+
+ var b bool;
+
+ --
+ -- select kids grouped by gender
+ --
+
+ cursor xCur as
+ select gender, count(*) from kids group by gender order by count(*) asc;
+ :b = fetch xCur into ( :g1, :i1 );
+ :b = fetch xCur into ( :g2, :i2 );
+ close xCur;
+
+ if :g2 = 'boy' and :i2 = 12 and :g1 = 'girl' and :i1 = 6
+ then
+ :res = 'ok';
+ end;
+
+ :msg = 'Grouped kids order by count(*)';
+
+ return :res;
+end;
+@
+
+
+@
+create procedure checkSelect006(msg out string(20)) return string(10)
+begin
+ var res string(10) = 'error';
+ var fn string(10);
+
+ var b bool;
+
+ --
+ -- select kids who have all toys ( allquantor test )
+ --
+
+ cursor xCur as
+ select forename from kids k where not exists
+ ( select * from kidtoys kt where not exists
+ ( select * from toy2kid t2k where k.kid = t2k.kid and t2k.tid = kt.tid ));
+
+
+ :b = fetch xCur into ( :fn );
+
+ close xCur;
+
+ if :fn = 'anna'
+ then
+ :res = 'ok';
+ end;
+
+ :msg = 'Kids with all toys';
+
+ return :res;
+end;
+@
+
+:r = call checkSelect001(:msg);
+insert into checklog values ('B', :msg, :r);
+:r = call checkSelect002(:msg);
+insert into checklog values ('B', :msg, :r);
+:r = call checkSelect003(:msg);
+insert into checklog values ('B', :msg, :r);
+:r = call checkSelect004(:msg);
+insert into checklog values ('B', :msg, :r);
+:r = call checkSelect005(:msg);
+insert into checklog values ('B', :msg, :r);
+:r = call checkSelect006(:msg);
+insert into checklog values ('B', :msg, :r);
+
+
+
+drop procedure checkSelect001;
+drop procedure checkSelect002;
+drop procedure checkSelect003;
+drop procedure checkSelect004;
+drop procedure checkSelect005;
+drop procedure checkSelect006;
+
+drop view kidview;
+drop view kidtoyview;
+drop table kids;
+drop table kidtoys;
+drop table kidgroup;
+drop table toy2kid;
+
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/gates/cegodb.xml
^
|
@@ -2,9 +2,9 @@
<!DOCTYPE CEGO_DB_SPEC>
<DATABASE NAME="cegodb" PAGESIZE="16384" ADMINPORT="2000" LOGPORT="3000" DATAPORT="2200" PIDFILE="./db/pid" MAXFID="32" MAXTSID="2" NUMRECSEMA="281" NUMSYSPAGESEMA="53" NUMDATAPAGESEMA="281" NUMIDXPAGESEMA="281" NUMRBPAGESEMA="281" NUMDATAFILESEMA="53" NUMBUFFERPOOLSEMA="31" CSMODE="ON">
 <MODULE NAME="ALL" LEVEL="DEBUG"></MODULE>
<USER NAME="cgadm" PASSWD="f9d1bb5de113b12009fd4b1672a23cfe"></USER>
- <TABLESET NAME="TS1" TSROOT="./db" PRIMARY="dude.local" SECONDARY="dude.local" MEDIATOR="dude.local" RUNSTATE="OFFLINE" SYNCSTATE="SYNCHED" TSTICKET="./db/tsticket.xml" TSID="2" TMPFID="31" SYSSIZE="100" TMPSIZE="100" SORTAREASIZE="10000000" LSN="185"> <LOGFILE NAME="./db/TS1redo0.log" SIZE="1000000" STATUS="FREE"></LOGFILE>
- <LOGFILE NAME="./db/TS1redo1.log" SIZE="1000000" STATUS="ACTIVE"></LOGFILE>
- <LOGFILE NAME="./db/TS1redo2.log" SIZE="1000000" STATUS="FREE"></LOGFILE>
+ <TABLESET NAME="TS1" TSROOT="./db" PRIMARY="dude.local" SECONDARY="dude.local" MEDIATOR="dude.local" RUNSTATE="OFFLINE" SYNCSTATE="SYNCHED" TSTICKET="./db/tsticket.xml" TSID="2" TMPFID="31" SYSSIZE="100" TMPSIZE="100" SORTAREASIZE="10000000" LSN="230"> <LOGFILE NAME="./db/TS1redo0.log" SIZE="1000000" STATUS="FREE"></LOGFILE>
+ <LOGFILE NAME="./db/TS1redo1.log" SIZE="1000000" STATUS="FREE"></LOGFILE>
+ <LOGFILE NAME="./db/TS1redo2.log" SIZE="1000000" STATUS="ACTIVE"></LOGFILE>
<DATAFILE TYPE="APP" FILEID="32" NAME="./db/data01.dbf" SIZE="1000"></DATAFILE>
<USER NAME="lemke" PASSWD="20eb196673144f5c299ef3d0d7a58bd9" ROLE="ALL"></USER>
</TABLESET>
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/gates/gatecheck
^
|
@@ -1,12 +1,9 @@
#!/bin/sh
./mkdb
-# echo "Step 1"
../src/cego --mode=batch --batchfile=pre.sql --dbxml=cegodb.xml --poolsize=1000 --tableset=TS1 > check.log 2> error.log
-# echo "Step 2"
- ../src/cego --mode=batch --batchfile=A.sql --dbxml=cegodb.xml --poolsize=1000 --tableset=TS1 > check.log 2> error.log
-# echo "Step 3"
+../src/cego --mode=batch --batchfile=A.sql --dbxml=cegodb.xml --poolsize=1000 --tableset=TS1 > check.log 2> error.log
../src/cego --mode=batch --batchfile=B.sql --dbxml=cegodb.xml --poolsize=1000 --tableset=TS1 > check.log 2> error.log
-# echo "Step 4"
+../src/cego --mode=batch --batchfile=C.sql --dbxml=cegodb.xml --poolsize=1000 --tableset=TS1 > check.log 2> error.log
../src/cego --mode=batch --batchfile=post.sql --dbxml=cegodb.xml --poolsize=1000 --tableset=TS1
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/gates/pre.sql
^
|
@@ -3,4 +3,4 @@
--
--
-create table checklog( gate string(3), checkname string(30), result string(20));
+create table checklog( gate string(3), checkname string(40), result string(10));
|
[-]
[+]
|
Added |
cego-2.10.4.tar.bz2/install
^
|
@@ -0,0 +1,250 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/samples/chkdb/chkup
^
|
@@ -6,5 +6,5 @@
exit 1
fi
-../../src/cego --mode=daemon --forceload --nolockstat --dbxml=chkdb.xml --poolsize=5000 --tableset=$1
+../../src/cego --mode=daemon --forceload --numdbthread=10 --nolockstat --dbxml=chkdb.xml --poolsize=3000 --tableset=$1
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/samples/chkdb/mkdb
^
|
@@ -21,8 +21,8 @@
ADMINUSER=cgadm
ADMINPWD=cgadm
-DEBUGLEVEL=DEBUG
-# DEBUGLEVEL=NOTICE
+# DEBUGLEVEL=DEBUG
+DEBUGLEVEL=NOTICE
### end of customizing ###
|
|
Changed |
cego-2.10.4.tar.bz2/samples/chkdb/more
^
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoAttrComp.cc
^
|
@@ -152,6 +152,7 @@
{
_isSetup = true;
+
_fv = pF->getValue();
}
pF = joinBuf[i].Next();
@@ -173,7 +174,7 @@
return (*this);
}
-bool CegoAttrComp::operator == ( const CegoAttrComp& ac)
+bool CegoAttrComp::operator == ( const CegoAttrComp& ac) const
{
if ( _compMode != ac._compMode )
return false;
@@ -185,6 +186,7 @@
if ( _compMode == BTWN )
return (_attrName == ac._attrName && _fv == ac._fv && _fv2 == ac._fv2 );
+ return false;
}
Chain CegoAttrComp::toChain() const
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoAttrComp.h
^
|
@@ -72,7 +72,7 @@
bool isSetup();
CegoAttrComp& operator = ( const CegoAttrComp& ac);
- bool operator == ( const CegoAttrComp& ac);
+ bool operator == ( const CegoAttrComp& ac) const;
Chain toChain() const;
friend ostream& operator << (ostream& s, const CegoAttrComp& ac);
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoAttrCond.cc
^
|
@@ -56,6 +56,32 @@
return _attrCompSet.Size();
}
+int CegoAttrCond::getStrength() const
+{
+ CegoAttrComp *pAC = _attrCompSet.First();
+ if ( pAC )
+ {
+ if ( pAC->getCompMode() == CegoAttrComp::BTWN )
+ return 4;
+ switch ( pAC->getComparison() )
+ {
+ case EQUAL:
+ return 5;
+ case NOT_EQUAL:
+ return 1;
+ case LESS_THAN:
+ return 3;
+ case MORE_THAN:
+ return 3;
+ case LESS_EQUAL_THAN:
+ return 2;
+ case MORE_EQUAL_THAN:
+ return 2;
+ }
+ }
+ return 0;
+}
+
SetT<CegoAttrComp>& CegoAttrCond::getAttrCompSet()
{
return _attrCompSet;
@@ -64,20 +90,20 @@
CegoAttrCond CegoAttrCond::getFilterCond(const ListT<CegoField>& fl) const
{
CegoAttrCond ac;
-
- CegoAttrComp *pAC = _attrCompSet.First();
- while ( pAC )
- {
- CegoField *pF = fl.First();
- while ( pF )
+
+ CegoField *pF = fl.First();
+ while ( pF )
+ {
+ CegoAttrComp *pAC = _attrCompSet.First();
+ while ( pAC )
{
if ( pF->getAttrName() == pAC->getAttrName() )
{
ac.add(*pAC);
}
- pF = fl.Next();
+ pAC = _attrCompSet.Next();
}
- pAC = _attrCompSet.Next();
+ pF = fl.Next();
}
return ac;
}
@@ -165,36 +191,30 @@
CegoAttrCond::IndexMatch CegoAttrCond::checkIndex(const ListT<CegoField>& schema) const
{
+ int numFound=0;
+ bool isLeak=false;
CegoField *pF = schema.First();
- while ( pF )
+ while ( pF && isLeak == false )
{
- bool notFound = true;
- CegoAttrComp *pComp = _attrCompSet.First();
- while ( pComp && notFound )
+ CegoAttrComp *pComp = _attrCompSet.First();
+ while ( pComp )
{
if ( pComp->getAttrName() == pF->getAttrName() )
- notFound = false;
+ numFound++;
+ else
+ isLeak=true;
pComp = _attrCompSet.Next();
}
- if ( notFound )
- {
- return INAPP;
- }
pF = schema.Next();
}
- CegoAttrComp *pComp = _attrCompSet.First();
- while ( pComp )
- {
- if ( schema.Find(CegoField(Chain(), pComp->getAttrName())) == 0)
- {
- return PART;
- }
- pComp = _attrCompSet.Next();
- }
+ if ( numFound == _attrCompSet.Size() )
+ return FULL;
- return FULL;
-
+ if ( numFound < _attrCompSet.Size() && numFound > 0 )
+ return PART;
+
+ return INAPP;
}
@@ -243,6 +263,48 @@
}
}
+bool CegoAttrCond::diff( const CegoAttrCond& ac) const
+{
+
+ if ( ac._attrCompSet.Size() != _attrCompSet.Size() )
+ return false;
+
+ CegoAttrComp* pAC = ac._attrCompSet.First();
+ while ( pAC )
+ {
+ CegoAttrComp* pAC2 = _attrCompSet.Find(*pAC);
+ if ( pAC2 )
+ {
+ if ( pAC->getFieldValue() != pAC2->getFieldValue() )
+ return false;
+ }
+ else
+ {
+ return false;
+ }
+ pAC = ac._attrCompSet.Next();
+ }
+
+ pAC = _attrCompSet.First();
+ while ( pAC )
+ {
+ CegoAttrComp* pAC2 = ac._attrCompSet.Find(*pAC);
+ if ( pAC2 )
+ {
+ if ( pAC->getFieldValue() != pAC2->getFieldValue() )
+ return false;
+ }
+ else
+ {
+ return false;
+ }
+ pAC = _attrCompSet.Next();
+ }
+
+ return true;
+
+}
+
CegoAttrCond& CegoAttrCond::operator = ( const CegoAttrCond& ac)
{
_idxSchema = ac._idxSchema;
@@ -260,7 +322,7 @@
while ( pAC )
{
if ( _attrCompSet.Find(*pAC) == false )
- return false;
+ return false;
pAC = ac._attrCompSet.Next();
}
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoAttrCond.h
^
|
@@ -54,6 +54,7 @@
void add(const CegoAttrComp& attrComp);
int numComp() const;
+ int getStrength() const;
SetT<CegoAttrComp>& getAttrCompSet();
@@ -72,6 +73,8 @@
void asConjunctionList(const ListT<CegoExpr*>& exprList, ListT<CegoPredDesc*>& conjunctionList) const;
+ bool diff( const CegoAttrCond& ac) const;
+
CegoAttrCond& operator = ( const CegoAttrCond& ac);
bool operator == ( const CegoAttrCond& ac) const;
bool operator != ( const CegoAttrCond& ac) const;
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoDbThread.cc
^
|
@@ -61,12 +61,6 @@
{
_pPool = pPool;
_pDBMng = pDBMng;
- _modId = pDBMng->getModId("CegoDbThread");
- _pTabMng = new CegoDistManager(_pDBMng);
- _pPA = new CegoAction(_pTabMng, _pPool);
-
- loadLock.init(LCKMNG_LOCKWAITDELAY);
-
_modId = _pDBMng->getModId("CegoDbThread");
}
@@ -116,8 +110,14 @@
{
_idx = *(long*)arg;
+ _pTabMng = new CegoDistManager(_pDBMng);
+ _pPA = new CegoAction(_pTabMng, _pPool);
+
+ loadLock.init(LCKMNG_LOCKWAITDELAY);
+
_pTabMng->setPoolSyncInfo(_pPool, _idx);
_pPool->setTid(_idx, getTid());
+ _pPool->setThreadState(_idx, CegoDbThreadPool::READY);
while ( ! _pPool->isTerminated() )
{
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoDbThreadPool.cc
^
|
@@ -60,49 +60,11 @@
CegoDbThreadPool::CegoDbThreadPool(int poolLimit, CegoDatabaseManager *pDBMng) : Thread()
{
- queueLock.init(LCKMNG_LOCKWAITDELAY, __lockStatOn);
-
_poolLimit = poolLimit;
-
- thrLockArray = new ThreadLock*[poolLimit];
-
- for (int i = 0; i<_poolLimit; i++)
- {
- thrLockArray[i] = new ThreadLock(Chain("THRLCK") + Chain(i));
- thrLockArray[i]->init(LCKMNG_LOCKWAITDELAY, __lockStatOn);
- }
-
-
- pDBMng->getDataPort(_dataPortNo);
-
- _threadId = (long*)malloc(_poolLimit * sizeof(long));
- _numRequest = (long*)malloc(_poolLimit * sizeof(long));
- _numQueryRequest = (long*)malloc(_poolLimit * sizeof(long));
- _threadState = (ThreadState*)malloc(_poolLimit * sizeof(ThreadState));
- _threadList = (CegoDbThread**)malloc(_poolLimit * sizeof(CegoDbThread*));
-
- _terminated=false;
-
- long i=0;
- while ( i < _poolLimit )
- {
-
- _threadState[i] = READY;
- _threadList[i]= new CegoDbThread(this, pDBMng);
- _numRequest[i]=0;
- _numQueryRequest[i]=0;
- _threadId[i]=i;
- _threadList[i]->start(&_threadId[i]);
-
- i++;
- }
-
_pDBMng = pDBMng;
-
_modId = _pDBMng->getModId("CegoDbThreadPool");
}
-
CegoDbThreadPool::~CegoDbThreadPool()
{
_terminated=true;
@@ -133,6 +95,8 @@
_pDBMng->log(_modId, Logger::NOTICE, Chain("Canceling hanging db sessions ..."));
cancel();
}
+
+
i=0;
while ( i < _poolLimit )
{
@@ -158,6 +122,57 @@
thrLockArray[i]->unlock();
}
+
+void CegoDbThreadPool::syncToReady()
+{
+
+ queueLock.init(LCKMNG_LOCKWAITDELAY, __lockStatOn);
+ thrLockArray = new ThreadLock*[_poolLimit];
+
+ _pDBMng->getDataPort(_dataPortNo);
+
+ _threadId = (long*)malloc(_poolLimit * sizeof(long));
+ _numRequest = (long*)malloc(_poolLimit * sizeof(long));
+ _numQueryRequest = (long*)malloc(_poolLimit * sizeof(long));
+ _threadState = (ThreadState*)malloc(_poolLimit * sizeof(ThreadState));
+ _threadList = (CegoDbThread**)malloc(_poolLimit * sizeof(CegoDbThread*));
+
+ _terminated=false;
+
+ long i=0;
+ while ( i < _poolLimit )
+ {
+ _threadState[i] = STARTING;
+ _threadList[i]= new CegoDbThread(this, _pDBMng);
+ _numRequest[i]=0;
+ _numQueryRequest[i]=0;
+ _threadId[i]=i;
+ _threadList[i]->start(&_threadId[i]);
+ i++;
+ }
+
+ for (int i = 0; i<_poolLimit; i++)
+ {
+ thrLockArray[i] = new ThreadLock(Chain("THRLCK") + Chain(i));
+ thrLockArray[i]->init(LCKMNG_LOCKWAITDELAY, __lockStatOn);
+ }
+
+ int numReady=0;
+ while ( numReady < _poolLimit )
+ {
+ numReady=0;
+ int i=0;
+ while ( i < _poolLimit )
+ {
+ if ( _threadState[i] == READY )
+ numReady++;
+ i++;
+ }
+ _pDBMng->log(_modId, Logger::NOTICE, Chain(numReady) + Chain(" of " ) + Chain(_poolLimit) + Chain(" db threads ready"));
+ }
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("All db threads ready"));
+}
+
void CegoDbThreadPool::loadObjects(int tabSetId)
{
int i=0;
@@ -239,6 +254,11 @@
_threadId[i] = tid;
}
+void CegoDbThreadPool::setThreadState(long i, CegoDbThreadPool::ThreadState state)
+{
+ _threadState[i] = state;
+}
+
void CegoDbThreadPool::abortThread(long i)
{
_threadList[i]->abortSession();
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoDbThreadPool.h
^
|
@@ -49,7 +49,7 @@
public:
- enum ThreadState { READY, CONNECTED, BUSY };
+ enum ThreadState { STARTING, READY, CONNECTED, BUSY };
CegoDbThreadPool();
CegoDbThreadPool(int poolLimit, CegoDatabaseManager *pDBMng);
@@ -57,6 +57,8 @@
void* job(void* arg);
+ void syncToReady();
+
void loadObjects(int tabSetId);
void unloadObjects(int tabSetId);
void invalidateObject(int tabSetId, const Chain& objName, CegoObject::ObjectType type);
@@ -69,7 +71,7 @@
void incNumRequest(long i);
void incNumQueryRequest(long i);
void setTid(long i, long tid);
-
+ void setThreadState(long i, CegoDbThreadPool::ThreadState state);
void abortThread(long i);
NetHandler* nextRequest();
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoDefs.h
^
|
@@ -40,7 +40,7 @@
#endif
#define CEGO_PRODUCT "Cego"
-#define CEGO_VERSION "2.10.2"
+#define CEGO_VERSION "2.10.4"
#define CEGO_COPYRIGHT "Copyright (C) 2000-2011 by Bjoern Lemke. All rights reserved"
/*******************************/
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoDistCursor.cc
^
|
@@ -235,6 +235,8 @@
if ( _pCO->getType() == CegoObject::VIEW )
{
_pSelect->setTabSetId(_tabSetId);
+ CegoAttrCond noCond;
+ _pSelect->setViewCond(noCond);
_pSelect->prepare();
_pSelect->setParentJoinBuf();
@@ -408,7 +410,7 @@
{
if ( pAC->isSetup() == false )
{
- Chain msg = Chain("Unknown attribute ") + pAC->getAttrName();
+ Chain msg = Chain("Cannot get value for attribute ") + pAC->getAttrName();
throw Exception(EXLOC, msg);
}
}
@@ -766,15 +768,16 @@
if ( _moreRight )
{
_innerCond.setup(flArray, offset+size-1, 1);
-
+
_pTCLeft->reset();
if ( _isAttrCondValid )
_pTCLeft->distSetup(_innerCond);
else
_pTCLeft->distSetup();
-
+
_moreLeft = _pTCLeft->nextTuple(flArray, offset, size-1);
+
}
_isFirst = false;
}
@@ -891,9 +894,9 @@
if ( _pTCRight )
_pTCRight->reset();
}
- else
+ else if ( _pCO->getType() == CegoObject::SYSTEM )
{
- throw Exception(EXLOC, Chain("Invalid content type"));
+ // nothing to do
}
}
@@ -928,34 +931,33 @@
CegoJoinObject *pJO = (CegoJoinObject*)_pCO;
- ListT<CegoField> aSchema;
- ListT<CegoField> bSchema;
+ ListT<CegoField> outerSchema;
+ ListT<CegoField> innerSchema;
CegoAttrCond addInnerCond;
if ( pJO->getJoinType() == CegoJoinObject::INNER || pJO->getJoinType() == CegoJoinObject::LEFTOUTER )
{
+ outerSchema = pJO->getLeftObject()->getSchema();
+ innerSchema = pJO->getRightObject()->getSchema();
- bSchema = pJO->getLeftObject()->getSchema();
- aSchema = pJO->getRightObject()->getSchema();
-
- _cursorCond = attrCond.getFilterCond(bSchema);
- addInnerCond = attrCond.getFilterCond(aSchema);
+ _cursorCond = attrCond.getFilterCond(outerSchema);
+ addInnerCond = attrCond.getFilterCond(innerSchema);
}
else if ( pJO->getJoinType() == CegoJoinObject::RIGHTOUTER )
{
- aSchema = pJO->getLeftObject()->getSchema();
- bSchema = pJO->getRightObject()->getSchema();
+ innerSchema = pJO->getLeftObject()->getSchema();
+ outerSchema = pJO->getRightObject()->getSchema();
- _cursorCond = attrCond.getFilterCond(aSchema);
- addInnerCond = attrCond.getFilterCond(bSchema);
+ _cursorCond = attrCond.getFilterCond(outerSchema);
+ addInnerCond = attrCond.getFilterCond(innerSchema);
}
CegoAttrCond ac;
CegoQueryHelper qh;
- bool predAttrCondValid = qh.evalAttrCond(ac, pJO->getPredDesc(), aSchema, &bSchema, 1, 0);
+ bool predAttrCondValid = qh.evalAttrCond(ac, pJO->getPredDesc(), innerSchema, &outerSchema, 1, 0);
if ( predAttrCondValid )
{
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoDistManager.cc
^
|
@@ -1569,7 +1569,7 @@
getObjectListByTable(tabSetId, tabName, idxList, keyList, checkList, ignoreInvalid);
}
-bool CegoDistManager::distIndexExists(int tabSetId, const Chain& tableName, CegoAttrCond& ac)
+CegoAttrCond::IndexMatch CegoDistManager::distIndexExists(int tabSetId, const Chain& tableName, CegoAttrCond& ac)
{
ListT<CegoTableObject> idxList;
ListT<CegoKeyObject> keyList;
@@ -1583,21 +1583,25 @@
{
getObjectListByTable(tabSetId, tableName, idxList, keyList, checkList);
+ CegoAttrCond::IndexMatch idxMatch = CegoAttrCond::INAPP;
+
CegoTableObject *pIO = idxList.First();
while ( pIO )
{
CegoTableObject idx;
getObject(tabSetId, pIO->getName(), pIO->getType(), idx);
-
- CegoAttrCond::IndexMatch idxMatch = ac.checkIndex(idx.getSchema());
- if ( idxMatch == CegoAttrCond::FULL || idxMatch == CegoAttrCond::PART )
- return true;
-
+ CegoAttrCond::IndexMatch nextMatch = ac.checkIndex(idx.getSchema());
+
+ if ( nextMatch == CegoAttrCond::FULL )
+ return nextMatch;
+ if ( idxMatch == CegoAttrCond::INAPP && nextMatch == CegoAttrCond::PART )
+ idxMatch = CegoAttrCond::PART;
+
pIO = idxList.Next();
}
- return false;
+ return idxMatch;
}
else
{
@@ -1627,6 +1631,8 @@
throw Exception(EXLOC, msg);
}
+ CegoAttrCond::IndexMatch idxMatch = CegoAttrCond::INAPP;
+
CegoTableObject *pIO = idxList.First();
while ( pIO )
{
@@ -1638,15 +1644,17 @@
{
idx.putElement( pSH->getObjElement() );
idx.setLocal(false);
+
-
- CegoAttrCond::IndexMatch idxMatch = ac.checkIndex(idx.getSchema());
+ CegoAttrCond::IndexMatch nextMatch = ac.checkIndex(idx.getSchema());
- if ( idxMatch == CegoAttrCond::FULL || idxMatch == CegoAttrCond::PART )
+ if ( nextMatch == CegoAttrCond::FULL )
{
_pDBMng->releaseSession(pSH);
- return true;
+ return nextMatch;
}
+ if ( idxMatch == CegoAttrCond::INAPP && nextMatch == CegoAttrCond::PART )
+ idxMatch = CegoAttrCond::PART;
}
else if ( res == CegoDbHandler::DB_ERROR )
@@ -1659,7 +1667,7 @@
pIO = idxList.Next();
}
_pDBMng->releaseSession(pSH);
- return false;
+ return idxMatch;
}
}
@@ -2040,9 +2048,13 @@
maxAttrLen = pF->getAttrName().length();
pF = io.getSchema().Next();
}
+
+ int maxTabLen=10;
+ if ( io.getTabName().length() > maxTabLen )
+ maxTabLen = io.getTabName().length();
schema.Insert(CegoField(Chain("INDEXDESC"), Chain("TABLEDESC"), Chain("ATTR"), VARCHAR_TYPE, maxAttrLen));
- schema.Insert(CegoField(Chain("INDEXDESC"), Chain("TABLEDESC"), Chain("TABLE"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("INDEXDESC"), Chain("TABLEDESC"), Chain("TABLE"), VARCHAR_TYPE, maxTabLen));
schema.Insert(CegoField(Chain("INDEXDESC"), Chain("TABLEDESC"), Chain("TYPE"), VARCHAR_TYPE, 10));
pF = io.getSchema().First();
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoDistManager.h
^
|
@@ -107,7 +107,7 @@
void getDistObjectByTableList(const Chain& tableSet, const Chain& tabName, ListT<CegoTableObject> &idxList, ListT<CegoKeyObject>& keyList, ListT<CegoCheckObject>& checkList, bool ignoreInvalid = true);
void getLocalObjectByTableList(int tabSetId, const Chain& tabName, ListT<CegoTableObject> &idxList, ListT<CegoKeyObject>& keyList, ListT<CegoCheckObject>& checkList, bool ignoreInvalid = true);
- bool distIndexExists(int tabSetId, const Chain& tableName, CegoAttrCond& ac);
+ CegoAttrCond::IndexMatch distIndexExists(int tabSetId, const Chain& tableName, CegoAttrCond& ac);
int getDistPageCount(const Chain& tableSet, const Chain& tabName, CegoObject::ObjectType type);
int getLocalPageCount(int tabSetId, const Chain& tabName, CegoObject::ObjectType type);
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoIndexCursor.cc
^
|
@@ -677,7 +677,7 @@
CegoTupleState ts;
_qh.decodeFVL(fl, p, len, tid, tastep, ts);
_pTM->releaseDataPtr(dataLock, false);
-
+
return true;
}
}
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoMain.cc
^
|
@@ -1293,6 +1293,9 @@
pDBMng->log(modId, Logger::DEBUG, "Creating db threadpool ...");
CegoDbThreadPool* pDbPool = new CegoDbThreadPool(numDbThread.asInteger(), pDBMng);
+ pDBMng->log(modId, Logger::DEBUG, "Sync db pool to ready ...");
+ pDbPool->syncToReady();
+ pDBMng->log(modId, Logger::DEBUG, "DB Pool is ready");
pDBMng->log(modId, Logger::DEBUG, "Creating log threadpool ...");
CegoLogThreadPool* pLogPool = new CegoLogThreadPool(numLogThread.asInteger(), pDBMng);
@@ -1355,7 +1358,7 @@
}
}
-
+
if ( startTableSet )
{
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoSelect.cc
^
|
@@ -1666,7 +1666,6 @@
bool notFound = true;
while ( pPred && notFound )
{
-
_pLogger->log(_modId, Logger::DEBUG, Chain("Checking predicate ") + (*pPred)->toChain());
if ( (*pPred)->isChecked() == false )
{
@@ -1690,19 +1689,41 @@
//
bool useAttrCond = false;
+ CegoAttrCond::IndexMatch idxMatch = CegoAttrCond::INAPP;
+ bool predChecked = false;
+
if ( _joinList[i]->getType() == CegoObject::JOIN )
{
useAttrCond = true;
+ predChecked = true;
}
else if ( _pGTM->distObjectExists( _joinList[i]->getTabName(),
_joinList[i]->getTabSetId(),
- CegoObject::VIEW )
- ||
- _pGTM->distIndexExists( _joinList[i]->getTabSetId(),
- _joinList[i]->getTabName(),
- ac ) )
+ CegoObject::VIEW ) )
{
- useAttrCond = true;
+ useAttrCond = true;
+ predChecked = true;
+ }
+ else
+ {
+ idxMatch = _pGTM->distIndexExists( _joinList[i]->getTabSetId(),
+ _joinList[i]->getTabName(),
+ ac );
+ if ( idxMatch == CegoAttrCond::INAPP )
+ {
+ useAttrCond = false;
+ predChecked = false;
+ }
+ else if ( idxMatch == CegoAttrCond::PART )
+ {
+ useAttrCond = true;
+ predChecked = false;
+ }
+ else if ( idxMatch == CegoAttrCond::FULL )
+ {
+ useAttrCond = true;
+ predChecked = true;
+ }
}
if ( useAttrCond )
@@ -1721,7 +1742,7 @@
// mark the corresponding predicate as already check to avoid double checking
// in evalJoin
- (*pPred)->setChecked(true);
+ (*pPred)->setChecked(predChecked);
_attrPred[i] = *pPred;
}
else
@@ -2839,8 +2860,9 @@
pP = _viewConjunctionList.Next();
}
_viewConjunctionList.Empty();
-
- attrCond.asConjunctionList(_exprList, _viewConjunctionList);
+
+ if ( attrCond.numComp() > 0 )
+ attrCond.asConjunctionList(_exprList, _viewConjunctionList);
cleanUp();
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/CegoTableCursor.cc
^
|
@@ -77,19 +77,20 @@
CegoAttrCond::IndexMatch CegoTableCursor::setup( const CegoAttrCond& attrCond)
{
- if ( _idxSetup == false || attrCond != _attrCond )
+ if ( _idxSetup == false || attrCond.diff(_attrCond) == false )
{
_pLogger->log(_modId, Logger::DEBUG, Chain("Setting up tablecursor with ") + attrCond.toChain());
- _attrCond = attrCond;
_idxSetup = true;
_pTM->getObjectListByTable(_tabSetId, _tableName, _idxList, _keyList, _checkList);
_pOE = _idxList.First();
-
+
_idxMatch = CegoAttrCond::INAPP;
-
+
+ int strength = 0;
+
while ( _pOE && _idxMatch != CegoAttrCond::FULL )
{
if (_pOE->getType() == CegoObject::PINDEX
@@ -99,18 +100,32 @@
_pLogger->log(_modId, Logger::DEBUG, Chain("Checking index ") + _pOE->getName());
- CegoAttrCond::IndexMatch indexMatch = _attrCond.checkIndex(_pOE->getSchema());
+ CegoAttrCond::IndexMatch indexMatch = attrCond.checkIndex(_pOE->getSchema());
if ( indexMatch == CegoAttrCond::FULL || indexMatch == CegoAttrCond::PART )
{
- _attrCond.setIdxSchema(_pOE->getSchema());
-
- _idxName = _pOE->getName();
- _pLogger->log(_modId, Logger::DEBUG, Chain("Index matched for index ") + _idxName);
-
- _idxSchema = _pOE->getSchema();
- _type = _pOE->getType();
- _idxMatch = indexMatch;
+
+ CegoAttrCond checkCond = attrCond.getFilterCond(_pOE->getSchema());
+
+ if ( checkCond.getStrength() > strength )
+ {
+
+ strength = checkCond.getStrength();
+ _pLogger->log(_modId, Logger::DEBUG, Chain("Strength ") + Chain(strength) + Chain(" tops for ") + checkCond.toChain());
+ _attrCond = checkCond;
+ _attrCond.setIdxSchema(_pOE->getSchema());
+
+ _idxName = _pOE->getName();
+ _pLogger->log(_modId, Logger::DEBUG, Chain("Using index ") + _idxName );
+
+ _idxSchema = _pOE->getSchema();
+ _type = _pOE->getType();
+ _idxMatch = indexMatch;
+ }
+ else
+ {
+ _pLogger->log(_modId, Logger::DEBUG, Chain("Strength ") + Chain(strength) + Chain(" to weak for ") + checkCond.toChain());
+ }
}
}
_pOE = _idxList.Next();
@@ -118,8 +133,7 @@
}
else
{
- _attrCond = attrCond;
- _pLogger->log(_modId, Logger::DEBUG, Chain("Detected table cursor set up with ") + attrCond.toChain());
+ _pLogger->log(_modId, Logger::DEBUG, Chain("Tablecursor alread set up "));
}
// Setting up attribute condition to actual field values
@@ -130,7 +144,7 @@
}
else if ( _idxMatch == CegoAttrCond::PART )
{
- _pLogger->log(_modId, Logger::DEBUG, Chain("Index classified as not part qualified"));
+ _pLogger->log(_modId, Logger::DEBUG, Chain("Index classified as part qualified"));
}
else
_pLogger->log(_modId, Logger::DEBUG, Chain("Index classified as not qualified"));
|
[-]
[+]
|
Changed |
cego-2.10.4.tar.bz2/src/Makefile.in
^
|
@@ -25,7 +25,7 @@
# LDFLAGS = -static-libgcc
LDFLAGS = -L$(LIBDIR) @LDFLAGS@
# CFLAGS = -I$(INCDIR) @LDFLAGS@
-CFLAGS = -I$(INCDIR) -O2 -fPIC @CFLAGS@ @CPPFLAGS@
+CFLAGS = -I$(INCDIR) -fPIC @CFLAGS@ @CPPFLAGS@
RANLIB = @RANLIB@
CGSHLIBOPT = @CGSHLIBOPT@
WPSHLIBOPT = @WPSHLIBOPT@
|