[-]
[+]
|
Changed |
cego.changes
|
|
[-]
[+]
|
Changed |
cego.spec
^
|
|
[-]
[+]
|
Deleted |
cego-2.10.1.tar.bz2/samples/chkdb/#check005.sql#
^
|
@@ -1,84 +0,0 @@
---
--- ### Procedure checks
---
-
-
-create table srctab ( a int, b string(30));
-create table desttab ( a int, b string(30));
-create index srctab_i1 on srctab(a);
-
-insert into srctab values ( 1, 'fred');
-insert into srctab values ( 2, 'mark');
-insert into srctab values ( 3, 'berta');
-insert into srctab values ( 4, 'john');
-insert into srctab values ( 5, 'anna');
-
-@
-create procedure copytab ( copyCond in int ) return int
-begin
-
- var copyCount int;
- :copyCount = 0;
-
- var ca int;
- var cb string(30);
-
- cursor copyCursor as select a, b from srctab where a = :copyCond;
-
- while fetch copyCursor into ( :ca, :cb ) = true
- begin
- insert into desttab values ( :ca, :cb );
- :copyCount = :copyCount + 1 ;
- end;
-
- return :copyCount;
-
-end;
-@
-
-set a = 5;
-:r = call copytab(:a);
-print 'Return value = ' | :r;
-
-select * from desttab;
-
-delete from desttab;
-
-insert into desttab ( a, b ) select a, b from srctab;
-
-select * from desttab;
-
-drop table srctab;
-drop table desttab;
-drop procedure copytab;
-
-
-@
-create procedure myproc1 ( a in int ) return int
-begin
-
- return :a + 1;
-
-end;
-@
-
-@
-create procedure myproc2 ( b in int ) return int
-begin
-
- var ma int;
-
- :ma = myproc1( 3 * :b );
-
- return :ma + 1;
-
-end;
-@
-
-set x = 5;
-:r = call myproc2(:x);
-print :r;
-
-
-drop procedure myproc1;
-drop procedure myproc2;
|
[-]
[+]
|
Deleted |
cego-2.10.1.tar.bz2/samples/chkdb/bla
^
|
@@ -1,132 +0,0 @@
-Table t1 does not exist
-ok
-Table t2 does not exist
-ok
-Table t3 does not exist
-ok
-View v1 does not exist
-ok
-Table t1 created
-ok
-Table t2 created
-ok
-Table t3 created
-ok
-1 tuples inserted
-ok
-1 tuples inserted
-ok
-1 tuples inserted
-ok
-1 tuples inserted
-ok
-1 tuples inserted
-ok
-1 tuples inserted
-ok
-1 tuples inserted
-ok
-1 tuples inserted
-ok
-1 tuples inserted
-ok
-+-----------+-------------------------------+-----------+-------------------------------+-----------+-------------------------------+
-| tx | tx | ty | ty | tz | tz |
-| a | b | c | d | e | f |
-+-----------+-------------------------------+-----------+-------------------------------+-----------+-------------------------------+
-| 1 | xxx | 1 | xxx | 1 | xxx |
-| 1 | xxx | 1 | xxx | 2 | vvv |
-| 2 | RRR | 2 | vvv | 2 | vvv |
-+-----------+-------------------------------+-----------+-------------------------------+-----------+-------------------------------+
-ok
-+-----------+-------------------------------+-----------+-------------------------------+
-| t1 | t1 | t2 | t2 |
-| a | b | c | d |
-+-----------+-------------------------------+-----------+-------------------------------+
-| 1 | xxx | 1 | xxx |
-+-----------+-------------------------------+-----------+-------------------------------+
-ok
-+-----------+-------------------------------+-----------+-------------------------------+-----------+-------------------------------+
-| t1 | t1 | t2 | t2 | t3 | t3 |
-| a | b | c | d | e | f |
-+-----------+-------------------------------+-----------+-------------------------------+-----------+-------------------------------+
-+-----------+-------------------------------+-----------+-------------------------------+-----------+-------------------------------+
-ok
-+-----------+-------------------------------+-----------+-------------------------------+-----------+-------------------------------+
-| t1 | t1 | t2 | t2 | t3 | t3 |
-| a | b | c | d | e | f |
-+-----------+-------------------------------+-----------+-------------------------------+-----------+-------------------------------+
-| 1 | xxx | 1 | xxx | 1 | xxx |
-| 2 | RRR | 2 | vvv | 2 | vvv |
-| null | null | 3 | zzz | 3 | zzz |
-+-----------+-------------------------------+-----------+-------------------------------+-----------+-------------------------------+
-ok
-+-----------+-------------------------------+-----------+-------------------------------+-----------+-------------------------------+
-| t1 | t1 | t2 | t2 | t3 | t3 |
-| a | b | c | d | e | f |
-+-----------+-------------------------------+-----------+-------------------------------+-----------+-------------------------------+
-| null | null | null | null | 1 | xxx |
-| null | null | null | null | 2 | vvv |
-| null | null | null | null | 3 | zzz |
-+-----------+-------------------------------+-----------+-------------------------------+-----------+-------------------------------+
-ok
-View v1 created
-ok
-+-----------+-------------------------------+-----------+-------------------------------+
-| t1 | t1 | t2 | t2 |
-| a | b | c | d |
-+-----------+-------------------------------+-----------+-------------------------------+
-| 1 | xxx | 1 | xxx |
-| 2 | RRR | 2 | vvv |
-+-----------+-------------------------------+-----------+-------------------------------+
-ok
-+-----------+-------------------------------+-----------+-------------------------------+
-| t1 | t1 | t2 | t2 |
-| a | b | c | d |
-+-----------+-------------------------------+-----------+-------------------------------+
-| 1 | xxx | 1 | xxx |
-| 2 | RRR | 2 | vvv |
-+-----------+-------------------------------+-----------+-------------------------------+
-ok
-+-----------+-------------------------------+-----------+-------------------------------+
-| t1 | t1 | t2 | t2 |
-| a | b | c | d |
-+-----------+-------------------------------+-----------+-------------------------------+
-| 1 | xxx | 1 | xxx |
-| 2 | RRR | 2 | vvv |
-| 4 | yyy | null | null |
-+-----------+-------------------------------+-----------+-------------------------------+
-ok
-+-----------+-------------------------------+-----------+-------------------------------+
-| tx | tx | ty | ty |
-| a | b | c | d |
-+-----------+-------------------------------+-----------+-------------------------------+
-| 1 | xxx | 1 | xxx |
-| 2 | RRR | 2 | vvv |
-| null | null | 3 | zzz |
-+-----------+-------------------------------+-----------+-------------------------------+
-ok
-+-----------+
-| v1 |
-| A |
-+-----------+
-| 1 |
-| 2 |
-+-----------+
-ok
-+-----------+
-| v1 |
-| A |
-+-----------+
-| 1 |
-+-----------+
-ok
-View v1 dropped
-ok
-Table t1 dropped
-ok
-Table t2 dropped
-ok
-Table t3 dropped
-ok
-Batch done
|
[-]
[+]
|
Deleted |
cego-2.10.1.tar.bz2/samples/chkdb/check005.sql~
^
|
@@ -1,84 +0,0 @@
---
--- ### Procedure checks
---
-
-
-create table srctab ( a int, b string(30));
-create table desttab ( a int, b string(30));
-create index srctab_i1 on srctab(a);
-
-insert into srctab values ( 1, 'fred');
-insert into srctab values ( 2, 'mark');
-insert into srctab values ( 3, 'berta');
-insert into srctab values ( 4, 'john');
-insert into srctab values ( 5, 'anna');
-
-@
-create procedure copytab ( copyCond in int ) return int
-begin
-
- var copyCount int;
- :copyCount = 0;
-
- var ca int;
- var cb string(30);
-
- cursor copyCursor as select a, b from srctab where a = :copyCond;
-
- while fetch copyCursor into ( :ca, :cb ) = true
- begin
- insert into desttab values ( :ca, :cb );
- :copyCount = :copyCount + 1 ;
- end;
-
- return :copyCount;
-
-end;
-@
-
-set a = 5;
-:r = call copytab(:a);
-print 'Return value = ' | :r;
-
-select * from desttab;
-
-delete from desttab;
-
-insert into desttab ( a, b ) select a, b from srctab;
-
-select * from desttab;
-
-drop table srctab;
-drop table desttab;
-drop procedure copytab;
-
-
-@
-create procedure myproc1 ( a in int ) return int
-begin
-
- return :a + 1;
-
-end;
-@
-
-@
-create procedure myproc2 ( b in int ) return int
-begin
-
- var ma int;
-
- :ma = myproc1( 3 * :b );
-
- return :ma + 1;
-
-end;
-@
-
-set x = 5;
-:r = call myproc2(:x);
-print :r;
-
-
-drop procedure myproc1;
-drop procedure myproc2;
|
[-]
[+]
|
Deleted |
cego-2.10.1.tar.bz2/samples/chkdb/check013.sql~
^
|
@@ -1,196 +0,0 @@
---
--- ### Small logistic application sample
---
-
--- create required base tables
-create table supplier ( primary snr int not null, sname string(30), prio int);
-create table material ( primary mnr int not null, mname string(30), snr int);
-create table orders (primary onr int not null, mname string(30), orderdate datetime, cnr int);
-create table customer ( primary cnr int not null, cname string(30));
-create table ids ( primary id string(30) not null, idval int);
-
--- add indexes
-create index material_idx2 on material ( mname );
-create index material_idx1 on material ( snr );
-create index customer_idx1 on customer ( cname );
-create index orders_idx1 on orders ( mname );
-
--- add foreign key constraints
-alter table material add foreign key mat_fk ( snr ) references supplier ( snr );
-alter table orders add foreign key ord_fk ( cnr ) references customer ( cnr );
-
--- insert base data
-insert into supplier values ( 1, 'Time&Material', 3);
-insert into supplier values ( 2, 'Cego AG', 5);
-insert into supplier values ( 3, 'Moon Factory', 9);
-insert into supplier values ( 4, 'McDagobert', 3);
-insert into supplier values ( 11, 'HAL', 2);
-insert into supplier values ( 12, 'Abraxas', 1);
-insert into supplier values ( 13, 'ThunderStorm', 9);
-
-insert into material values ( 1, 'screw', 11);
-insert into material values ( 2, 'nail', 11);
-insert into material values ( 3, 'hammer', 1);
-insert into material values ( 4, 'saw', 2);
-insert into material values ( 5, 'nail', 2);
-insert into material values ( 6, 'knife', 1);
-insert into material values ( 7, 'screw', 2);
-insert into material values ( 8, 'saw', 11);
-insert into material values ( 9, 'hammer', 11);
-
-insert into customer values ( 23, 'John Smith');
-insert into customer values ( 24, 'John Smith');
-insert into customer values ( 25, 'John Smith');
-insert into customer values ( 26, 'John Smith');
-
-
-insert into orders values ( 4711, 'screw', sysdate, 23);
-insert into orders values ( 4712, 'nail', sysdate, 23);
-insert into orders values ( 4713, 'saw', sysdate, 23);
-insert into orders values ( 4714, 'hammer', sysdate, 23 );
--- insert into orders values ( 4715, 'spoon', sysdate , 23 );
--- insert into orders values ( 4716, 'fork', sysdate , 23 );
--- insert into orders values ( 4717, 'plate', sysdate , 23 );
--- insert into orders values ( 4722, 'car', date('%Y-%m-%d %H:%M:%S %Z', '2007-07-07 13:33:12 CET'), 23);
-
-insert into ids values ('ONR', 10000);
-insert into ids values ('SNR', 10000);
-insert into ids values ('MNR', 10000);
-insert into ids values ('CNR', 10000);
-
-
--- view sample
-create view matview as select sname as supname, mname as matname from material mat, supplier sup where sup.snr = mat.snr;
-
-
--- proc samples
-
-@
-create procedure nextId ( id in string(30) ) return int
-begin
-
- var actId int;
- var res bool;
-
- cursor actIdCur as select idval from ids where id = :id;
-
- :actId = 0;
-
- if fetch actIdCur into ( :actId ) = true
- then
- close actIdCur;
- :actId = :actId + 1;
- update ids set idval = :actId where id = :id;
- end;
-
- return :actId;
-
-end;
-@
-
-@
-create procedure nextId2 ( id in string(30) ) return int
-begin
-
- var idval int;
-
- update ids set idval = idval + 1 where id = :id return :idval = idval;
-
- return :idval;
-
-end;
-@
-
-@
-create procedure new_order (mname in string(30), cnr in int ) return int
-begin
-
- var onr int;
-
- :onr = nextId2('ONR');
- insert into orders values ( :onr, :mname, sysdate, :cnr );
-
- return :onr;
-
-end;
-@
-
-
-select * from matview;
-select supname from matview mv;
-select matname from matview mv;
-
-select mnr from material where snr = 1;
-
-:onr = call new_order('spoon', 23);
-
-:onr = call new_order('spoon', 24);
-:onr = call new_order('screw', 24);
-:onr = call new_order('hammer', 26);
-
-select count(*) from orders;
-
-
-select * from material;
-select * from orders;
-select * from supplier;
-
-list table;
-list view;
-list index;
-list procedure;
-
-select * from matview;
-
-select sname from supplier sup where snr = ( select mat.snr from material mat);
-
-select sname from supplier sup where snr in ( select mat.snr from material mat) ;
-
-select sname from supplier sup where snr not in ( select mat.snr from material mat) ;
-
-select mname from material mat, orders ord where mat.mname = ord.mname;
-
-select sname from supplier sup where not exists
- ( select * from orders ord where not exists
- ( select * from material mat where mat.snr = sup.snr and mat.mname = ord.mname ));
-
-
-
-
-
-select 1, mname, ( select sname from supplier sup where sup.snr = mat.snr ) from material mat;
-
-select sum( ( select prio from supplier sup where sup.snr = mat.snr ) ) from material mat;
-
-desc view matview;
-desc table orders;
-desc index material_idx1;
-
-desc table orders;
-tableinfo orders;
-
-
-drop view matview;
-
-drop table material;
-drop table orders;
-
-drop table supplier;
-drop table customer;
-drop table ids;
-
-
-drop procedure new_order;
-drop procedure nextId;
-drop procedure nextId2;
-
-
--- delete from supplier where snr = 12;
--- select * from material;
--- select * from supplier;
--- insert into material values ( 3, 'hammer', 1);
--- insert into material values ( 4, 'saw', 1);
--- insert into material values ( 8, 'saw', 2);
-
--- insert into orders values ( 4712, 'nail' , 24 );
--- insert into orders values ( 4713, 'saw' , 25 );
|
[-]
[+]
|
Deleted |
cego-2.10.1.tar.bz2/samples/chkdb/check022.sql~
^
|
@@ -1,56 +0,0 @@
---
--- ### Check grouping
---
-
--- create table t1 ( primary a int not null, b int );
--- alter table t1 add check chk1 on b < 10;
--- drop table t1;
-
-create table t1 ( a int, b string(10), c string(10));
-
-desc table t1;
-
--- empty table checks
-select count(*) from t1;
-select sum(a) from t1;
-select b, sum(a) from t1 group by b;
-
-insert into t1 values ( 10, 'hugo', 'erwin');
-insert into t1 values ( 20, 'hugo', 'ida');
-insert into t1 values ( 50, 'hugo', 'goofy');
-
-insert into t1 values ( 20, 'berta', 'goofy');
-insert into t1 values ( 10, 'berta', 'goofy');
-insert into t1 values ( 100, 'berta', 'goofy');
-
-insert into t1 values ( 100, 'ida', 'goofy');
-insert into t1 values ( 100, 'zara', 'goofy');
-
-insert into t1 values ( 1000, 'kuno', 'goofy');
-insert into t1 values ( 5, 'kuno', 'goofy');
-
-
-select b, count(*) from t1 group by b;
-select count(*), b from t1 group by b;
-select b, c, count(*) from t1 group by b, c;
-select b, count(*) from t1 group by b having count(*) = 2;
-select b, count(*) from t1 group by b having count(*) + 1 = 3;
-select b, 2 * count(*) from t1 group by b having count(*) + 1 = 3;
-select b, count(*) from t1 group by b order by count(*);
-select b, count(*) from t1 group by b having count(*) < 3 order by count(*);
-
-select b, avg(a) from t1 group by b;
-
-select b, sum(a) from t1 group by b order by sum(a);
-select a, b from t1 order by b;
-select a, b from t1 order by a;
-select a, b from t1 order by a, b;
-select b, sum(a) from t1 group by b order by sum(a) desc, b desc;
-select b, sum(a) from t1 group by b order by sum(a) desc, b asc;
-
-drop table t1;
-
-
-
-
-
|
[-]
[+]
|
Deleted |
cego-2.10.1.tar.bz2/samples/chkdb/mkdb~
^
|
@@ -1,106 +0,0 @@
-#!/bin/sh
-
-if [ $# -ne 1 ]
-then
- echo "Usage : mkdb <TS>,<TS>,.."
- exit 1
-fi
-
-TSLIST=`echo $1 | sed 's/,/ /g'`
-
-###############
-# database defs
-###############
-DBXML=chkdb.xml
-DBNAME=chkdb
-PAGESIZE=16384
-ADMPORT=2000
-DBPORT=2200
-LOGPORT=3000
-PIDFILE=./db/pid
-ADMINUSER=cgadm
-ADMINPWD=cgadm
-
-DEBUGLEVEL=DEBUG
-# DEBUGLEVEL=NOTICE
-
-### end of customizing ###
-
-rm -rf db
-mkdir db
-rm -f $DBXML
-
-echo "Creating xml ..."
-cat > $DBXML <<EOF
-<?xml version="1.0" ?>
-<!DOCTYPE CEGO_DB_SPEC>
-<DATABASE NAME="$DBNAME" PAGESIZE="$PAGESIZE" ADMINPORT="$ADMPORT" LOGPORT="$LOGPORT" DATAPORT="$DBPORT"
-PIDFILE="$PIDFILE" MAXFID="1" MAXTSID="1"
-NUMRECSEMA="1000" NUMSYSPAGESEMA="41" NUMDATAPAGESEMA="41"
-NUMIDXPAGESEMA="41" NUMRBPAGESEMA="41" NUMDATAFILESEMA="11" NUMBUFFERPOOLSEMA="11"
-MAXFIXTRIES="30"
- CSMODE="ON" QESCMODE="ON" LOGMNGPROG="./cglogmng">
-<MODULE NAME="ALL" LEVEL="$DEBUGLEVEL"></MODULE>
-</DATABASE>
-EOF
-
-# <MODULE NAME="CegoTableManager" LEVEL="NOTICE"></MODULE>
-# <MODULE NAME="CegoAdminThreadPool" LEVEL="NOTICE"></MODULE>
-# <MODULE NAME="CegoSelect" LEVEL="NOTICE"></MODULE>
-
-echo "Creating admin user ...\c"
-../../src/cego --mode=setadminuser --dbxml=${DBXML} --user=${ADMINUSER}/${ADMINPWD}
-if [ $? -eq 0 ]
-then
- echo "... operation ok"
-else
- echo "... operation failed"
- exit 1
-fi
-
-for TS in $TSLIST
-do
-
- TSROOT=./db
- TSTICKET=$TSROOT/${TS}ticket.xml
- SYSSIZE=100
- TMPSIZE=3000
- LOGFILESIZE=1000000
- LOGFILENUM=3
- APPFILE=$TSROOT/${TS}data01.dbf
- APPSIZE=1000
- SORTAREASIZE=10000000
- DBUSER=lemke
- DBPWD=lemke
-
-
- echo "Defining tableset $TS...\c"
- ../../src/cego --mode=define --tableset=${TS} -dbxml=${DBXML} --tsdef=tsroot:${TSROOT},tsticket:${TSTICKET},syssize:${SYSSIZE},tmpsize:${TMPSIZE},logfilesize:${LOGFILESIZE},logfilenum:${LOGFILENUM},appfile:${APPFILE},appsize:${APPSIZE},sortareasize:${SORTAREASIZE}
- if [ $? -eq 0 ]
- then
- echo "... operation ok"
- else
- echo "... operation failed"
- exit 1
- fi
-
- echo "Creating database user for $TS ...\c"
- ../../src/cego --mode=setdbuser --tableset=${TS} --dbxml=${DBXML} --user=${DBUSER}/${DBPWD} --role=ALL
- if [ $? -eq 0 ]
- then
- echo "... operation ok"
- else
- echo "... operation failed"
- exit 1
- fi
-
- echo "Creating tableset $TS...\c"
- ../../src/cego --mode=create --dbxml=${DBXML} --tableset=${TS}
- if [ $? -eq 0 ]
- then
- echo "... operation ok"
- else
- echo "... operation failed"
- exit 1
- fi
-done
|
[-]
[+]
|
Deleted |
cego-2.10.1.tar.bz2/samples/chkdb/x.sql
^
|
@@ -1,50 +0,0 @@
---
--- ### Outer join checks
---
-drop if exists table t1;
-drop if exists table t2;
-drop if exists table t3;
-drop if exists view v1;
-
-create table t1 ( primary a int not null, b string(30));
-create table t2 ( primary c int not null, d string(30));
-create table t3 ( primary e int not null, f string(30));
-
-insert into t1 values ( 1, 'xxx');
-insert into t1 values ( 2, 'RRR');
-insert into t1 values ( 4, 'yyy');
--- insert into t1 values ( 3, 'zzz');
-
-insert into t2 values ( 1, 'xxx');
-insert into t2 values ( 2, 'vvv');
-insert into t2 values ( 3, 'zzz');
-
-insert into t3 values ( 1, 'xxx');
-insert into t3 values ( 2, 'vvv');
-insert into t3 values ( 3, 'zzz');
-
-select * from t1 tx inner join t2 ty on tx.a = ty.c inner join t3 tz on ( tz.e = ty.c or tz.e = 2 );
--- in (select a from t1 where b = 'xxx'));
-
-select * from t1 inner join t2 on t1.a = t2.c where t2.d = 'xxx';
-select * from t1 inner join t2 on t1.a = t2.c inner join t3 on t3.e = t2.c where t3.f = 'zzz';
-select * from t1 right outer join t2 on t1.a = t2.c inner join t3 on t3.e = t2.c;
-select * from t1 inner join t2 on t1.a = t2.c right outer join t3 on t3.e = t2.c;
-
-create index ix on t3 ( f );
-create view v1 as select t1.a, t2.d from t1 inner join t2 on t1.a = t2.c inner join t3 on t3.e = 3 and ( t3.e = t2.c or t3.e = t1.a ) ;
-plan select * from v1;
-
--- select * from t1, t2 where t1.a = t2.c;
--- select * from t1 inner join t2 on t1.a = t2.c;
--- select * from t1 left outer join t2 on t1.a = t2.c;
--- select * from t1 tx right outer join t2 ty on tx.a = ty.c;
--- select A from v1;
--- select A from v1 where B = 'xxx';
-
--- drop if exists view v1;
--- drop if exists table t1;
--- drop if exists table t2;
--- drop if exists table t3;
-
-
|
[-]
[+]
|
Deleted |
cego-2.10.1.tar.bz2/samples/chkdb/x.sql~
^
|
@@ -1,49 +0,0 @@
---
--- ### Outer join checks
---
-drop if exists table t1;
-drop if exists table t2;
-drop if exists table t3;
-drop if exists view v1;
-
-create table t1 ( primary a int not null, b string(30));
-create table t2 ( primary c int not null, d string(30));
-create table t3 ( primary e int not null, f string(30));
-
-insert into t1 values ( 1, 'xxx');
-insert into t1 values ( 2, 'RRR');
-insert into t1 values ( 4, 'yyy');
--- insert into t1 values ( 3, 'zzz');
-
-insert into t2 values ( 1, 'xxx');
-insert into t2 values ( 2, 'vvv');
-insert into t2 values ( 3, 'zzz');
-
-insert into t3 values ( 1, 'xxx');
-insert into t3 values ( 2, 'vvv');
-insert into t3 values ( 3, 'zzz');
-
-select * from t1 tx inner join t2 ty on tx.a = ty.c inner join t3 tz on ( tz.e = ty.c or tz.e = 2 );
--- in (select a from t1 where b = 'xxx'));
-
-select * from t1 inner join t2 on t1.a = t2.c where t2.d = 'xxx';
-select * from t1 inner join t2 on t1.a = t2.c inner join t3 on t3.e = t2.c where t3.f = 'zzz';
-select * from t1 right outer join t2 on t1.a = t2.c inner join t3 on t3.e = t2.c;
-select * from t1 inner join t2 on t1.a = t2.c right outer join t3 on t3.e = t2.c;
-
-create index ix on t3 ( f );
-create view v1 as select t1.a, t2.d from t1 inner join t2 on t1.a = t2.c inner join t3 on t3.e = t2.c;
-
-select * from t1, t2 where t1.a = t2.c;
-select * from t1 inner join t2 on t1.a = t2.c;
-select * from t1 left outer join t2 on t1.a = t2.c;
-select * from t1 tx right outer join t2 ty on tx.a = ty.c;
--- select A from v1;
--- select A from v1 where B = 'xxx';
-
--- drop if exists view v1;
--- drop if exists table t1;
--- drop if exists table t2;
--- drop if exists table t3;
-
-
|
[-]
[+]
|
Deleted |
cego-2.10.1.tar.bz2/samples/chkdb/y.sql
^
|
@@ -1,19 +0,0 @@
-drop if exists table t1;
-create table t1 ( a int, b string(30));
--- desc table t1;
--- tableinfo t1;
-
-
-insert into t1 values ( 1, 'xxx');
-insert into t1 values ( 2, 'yyy');
-insert into t1 values ( 3, 'zzz');
-
-select a,b from t1;
-
-drop table t1;
-create table t1 ( a int, b string(30));
-insert into t1 values ( 1, 'xxx');
-insert into t1 values ( 2, 'yyy');
-insert into t1 values ( 3, 'zzz');
-
-select a,b from t1;
|
[-]
[+]
|
Deleted |
cego-2.10.1.tar.bz2/samples/chkdb/y.sql~
^
|
@@ -1,8 +0,0 @@
--- drop if exists table t2;
--- drop if exists table t1;
--- create table t1 ( a int );
--- insert into t1 values ( 42 );
--- create table t2 ( a int );
-select * from v1;
--- select * from t2;
-
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/README
^
|
@@ -4,7 +4,7 @@
----
A relational and transactional database system
- Version 2.10.1
+ Version 2.10.2
(C)opyright 2006,2007,2008,2009,2010,2011 by Bjoern Lemke
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/samples/cgplustest/Makefile
^
|
@@ -21,7 +21,7 @@
# LDFLAGS = -static-libgcc
LDFLAGS = -L../../src -L$(LIBDIR) -m64
# CFLAGS = -I$(INCDIR) -m64
-CFLAGS = -I../../src -I$(INCDIR) -fPIC -O3 -m64
+CFLAGS = -I../../src -I$(INCDIR) -fPIC -O3 -O2 -m64
RANLIB = ranlib
CGSHLIBOPT = -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1.
WPSHLIBOPT = -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1.
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/samples/cgwtest/Makefile
^
|
@@ -21,7 +21,7 @@
# LDFLAGS = -static-libgcc
LDFLAGS = -L../../src -L$(LIBDIR) -m64
# CFLAGS = -I$(INCDIR) -m64
-CFLAGS = -I../../src -I$(INCDIR) -fPIC -O3 -m64
+CFLAGS = -I../../src -I$(INCDIR) -fPIC -O3 -O2 -m64
RANLIB = ranlib
CGSHLIBOPT = -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1.
WPSHLIBOPT = -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1.
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoAttrComp.cc
^
|
@@ -146,7 +146,7 @@
CegoField* pF = joinBuf[i].First();
while (pF && _isSetup == false)
{
- // cout << "Checking T=" << pF->getTableName() << " A=" << pF->getAttrName() << "V=" << pF->getValue() << endl;
+ // cout << "Checking T=" << pF->getTableName() << " A=" << pF->getAttrName() << "Alias=" << pF->getTableAlias() << endl;
if ( ( _attrDesc.getTableName() == pF->getTableName() || _attrDesc.getTableName()== pF->getTableAlias() )
&& _attrDesc.getAttrName() == pF->getAttrName() )
{
@@ -174,8 +174,17 @@
}
bool CegoAttrComp::operator == ( const CegoAttrComp& ac)
-{
- return (_attrName == ac._attrName);
+{
+ if ( _compMode != ac._compMode )
+ return false;
+
+ if ( _compMode == ATTR )
+ return (_attrName == ac._attrName && _comp == ac._comp );
+ if ( _compMode == VAL )
+ return (_attrName == ac._attrName && _comp == ac._comp && _fv == ac._fv );
+ if ( _compMode == BTWN )
+ return (_attrName == ac._attrName && _fv == ac._fv && _fv2 == ac._fv2 );
+
}
Chain CegoAttrComp::toChain() const
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoAttrComp.h
^
|
@@ -51,7 +51,6 @@
CegoAttrComp();
CegoAttrComp(const Chain& attrName);
-
CegoAttrComp(const Chain& attrName, CegoComparison comp, const CegoFieldValue& fv);
CegoAttrComp(const Chain& attrName, CegoComparison comp, const CegoAttrDesc& attrDesc);
CegoAttrComp(const Chain& attrName, const CegoFieldValue& fv, const CegoFieldValue& fv2);
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoAttrCond.cc
^
|
@@ -48,96 +48,149 @@
void CegoAttrCond::add(const CegoAttrComp& attrComp)
{
- _attrCompList.Insert(attrComp);
+ _attrCompSet.Insert(attrComp);
}
int CegoAttrCond::numComp() const
{
- return _attrCompList.Size();
+ return _attrCompSet.Size();
}
-ListT<CegoAttrComp>& CegoAttrCond::getAttrCompList()
+SetT<CegoAttrComp>& CegoAttrCond::getAttrCompSet()
{
- return _attrCompList;
+ return _attrCompSet;
+}
+
+CegoAttrCond CegoAttrCond::getFilterCond(const ListT<CegoField>& fl) const
+{
+ CegoAttrCond ac;
+
+ CegoAttrComp *pAC = _attrCompSet.First();
+ while ( pAC )
+ {
+ CegoField *pF = fl.First();
+ while ( pF )
+ {
+ if ( pF->getAttrName() == pAC->getAttrName() )
+ {
+ ac.add(*pAC);
+ }
+ pF = fl.Next();
+ }
+ pAC = _attrCompSet.Next();
+ }
+ return ac;
}
bool CegoAttrCond::setup(const ListT<CegoField>& fl)
{
- CegoAttrComp *pAC = _attrCompList.First();
+ CegoAttrComp *pAC = _attrCompSet.First();
while ( pAC )
{
- if ( pAC->setup(fl) == false )
- return false;
- pAC = _attrCompList.Next();
+ if ( pAC->getCompMode() == CegoAttrComp::ATTR )
+ if ( pAC->setup(fl) == false )
+ return false;
+ pAC = _attrCompSet.Next();
}
return true;
}
bool CegoAttrCond::setup(ListT<CegoField>* joinBuf, int offset, int size)
{
- CegoAttrComp *pAC = _attrCompList.First();
+ CegoAttrComp *pAC = _attrCompSet.First();
while ( pAC )
{
- if ( pAC->setup(joinBuf, offset, size) == false )
- return false;
- pAC = _attrCompList.Next();
+ if ( pAC->getCompMode() == CegoAttrComp::ATTR )
+ if ( pAC->setup(joinBuf, offset, size) == false )
+ return false;
+ pAC = _attrCompSet.Next();
}
return true;
}
-void CegoAttrCond::asConjunctionList(ListT<CegoPredDesc*>& conjunctionList) const
+void CegoAttrCond::asConjunctionList(const ListT<CegoExpr*>& exprList, ListT<CegoPredDesc*>& conjunctionList) const
{
- CegoAttrComp *pAC = _attrCompList.First();
+ CegoAttrComp *pAC = _attrCompSet.First();
while ( pAC )
{
+
CegoPredDesc *pP;
+
+ CegoExpr *pExpr = getExpressionForAlias(exprList, pAC->getAttrName() );
+
+ if ( pExpr == 0 )
+ {
+ pExpr = new CegoExpr(new CegoTerm(new CegoFactor( new CegoAttrDesc(pAC->getAttrName()))));
+ }
+
if ( pAC->getCompMode() == CegoAttrComp::ATTR && pAC->isSetup() == false )
{
- pP = new CegoPredDesc(new CegoExpr(new CegoTerm(new CegoFactor( new CegoAttrDesc(pAC->getAttrName())))),
+ pP = new CegoPredDesc(pExpr,
new CegoExpr(new CegoTerm(new CegoFactor( pAC->getAttrDesc().clone()))),
pAC->getComparison());
}
else if ( pAC->getCompMode() == CegoAttrComp::VAL ||
( pAC->getCompMode() == CegoAttrComp::ATTR && pAC->isSetup() ) )
{
- pP = new CegoPredDesc(new CegoExpr(new CegoTerm(new CegoFactor( new CegoAttrDesc(pAC->getAttrName())))),
+ pP = new CegoPredDesc(pExpr,
new CegoExpr(new CegoTerm(new CegoFactor( pAC->getFieldValue()))),
pAC->getComparison());
}
else if ( pAC->getCompMode() == CegoAttrComp::BTWN )
{
- pP = new CegoPredDesc(new CegoExpr(new CegoTerm(new CegoFactor( new CegoAttrDesc(pAC->getAttrName())))),
+ pP = new CegoPredDesc(pExpr,
new CegoExpr(new CegoTerm(new CegoFactor( pAC->getFieldValue()))),
new CegoExpr(new CegoTerm(new CegoFactor( pAC->getFieldValue2()))));
}
+
conjunctionList.Insert(pP);
- pAC = _attrCompList.Next();
+ pAC = _attrCompSet.Next();
}
}
+CegoExpr* CegoAttrCond::getExpressionForAlias(const ListT<CegoExpr*>& exprList, const Chain& alias) const
+{
+ CegoExpr **pExpr = exprList.First();
+ while ( pExpr )
+ {
+ if ( (*pExpr)->getAlias() == alias )
+ return (*pExpr)->clone();
+ pExpr = exprList.Next();
+ }
+ return 0;
+}
+
CegoAttrCond::IndexMatch CegoAttrCond::checkIndex(const ListT<CegoField>& schema) const
{
CegoField *pF = schema.First();
while ( pF )
{
- if ( _attrCompList.Find(CegoAttrComp(pF->getAttrName())) == 0)
+ bool notFound = true;
+ CegoAttrComp *pComp = _attrCompSet.First();
+ while ( pComp && notFound )
+ {
+ if ( pComp->getAttrName() == pF->getAttrName() )
+ notFound = false;
+ pComp = _attrCompSet.Next();
+ }
+ if ( notFound )
{
return INAPP;
}
pF = schema.Next();
}
- CegoAttrComp *pComp = _attrCompList.First();
+ CegoAttrComp *pComp = _attrCompSet.First();
while ( pComp )
{
if ( schema.Find(CegoField(Chain(), pComp->getAttrName())) == 0)
{
return PART;
}
- pComp = _attrCompList.Next();
+ pComp = _attrCompSet.Next();
}
return FULL;
@@ -152,10 +205,10 @@
void CegoAttrCond::setPrimaryComparison(CegoComparison comp)
{
- CegoAttrComp* pAC = _attrCompList.First();
+ CegoAttrComp* pAC = _attrCompSet.First();
if ( pAC )
{
- pAC->setComparison(comp);
+ pAC->setComparison(comp);
}
else
{
@@ -165,7 +218,7 @@
CegoAttrComp::CompMode CegoAttrCond::getPrimaryCompMode() const
{
- CegoAttrComp* pAC = _attrCompList.First();
+ CegoAttrComp* pAC = _attrCompSet.First();
if ( pAC )
{
return pAC->getCompMode();
@@ -179,7 +232,7 @@
CegoComparison CegoAttrCond::getPrimaryComparison() const
{
- CegoAttrComp* pAC = _attrCompList.First();
+ CegoAttrComp* pAC = _attrCompSet.First();
if ( pAC )
{
return pAC->getComparison();
@@ -193,25 +246,31 @@
CegoAttrCond& CegoAttrCond::operator = ( const CegoAttrCond& ac)
{
_idxSchema = ac._idxSchema;
- _attrCompList = ac._attrCompList;
+ _attrCompSet = ac._attrCompSet;
return (*this);
}
bool CegoAttrCond::operator == ( const CegoAttrCond& ac) const
{
- CegoAttrComp* pAC1 = ac._attrCompList.First();
- CegoAttrComp* pAC2 = _attrCompList.First();
- while ( pAC1 && pAC2 )
+ if ( ac._attrCompSet.Size() != _attrCompSet.Size() )
+ return false;
+
+ CegoAttrComp* pAC = ac._attrCompSet.First();
+ while ( pAC )
{
- if ( ( *pAC1 == *pAC2 ) == false)
- return false;
+ if ( _attrCompSet.Find(*pAC) == false )
+ return false;
+ pAC = ac._attrCompSet.Next();
+ }
- pAC1 = ac._attrCompList.Next();
- pAC2 = _attrCompList.Next();
+ pAC = _attrCompSet.First();
+ while ( pAC )
+ {
+ if ( ac._attrCompSet.Find(*pAC) == false )
+ return false;
+ pAC = _attrCompSet.Next();
}
- if ( pAC1 || pAC2 )
- return false;
return true;
@@ -224,15 +283,36 @@
return true;
}
+
+CegoAttrCond operator + ( const CegoAttrCond& ac1, const CegoAttrCond& ac2 )
+{
+
+ CegoAttrCond ac;
+ CegoAttrComp *pComp;
+ pComp = ac1._attrCompSet.First();
+ while ( pComp )
+ {
+ ac.add(*pComp);
+ pComp = ac1._attrCompSet.Next();
+ }
+ pComp = ac2._attrCompSet.First();
+ while ( pComp )
+ {
+ ac.add(*pComp);
+ pComp = ac2._attrCompSet.Next();
+ }
+ return ac;
+}
+
Chain CegoAttrCond::toChain() const
{
Chain s;
- CegoAttrComp *pAC = _attrCompList.First();
+ CegoAttrComp *pAC = _attrCompSet.First();
while ( pAC )
{
s += pAC->toChain();
- pAC = _attrCompList.Next();
+ pAC = _attrCompSet.Next();
if ( pAC )
s += Chain(" and ");
}
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoAttrCond.h
^
|
@@ -36,6 +36,7 @@
///////////////////////////////////////////////////////////////////////////////
#include <lfc/ListT.h>
+#include <lfc/SetT.h>
#include <lfc/Chain.h>
#include "CegoAttrComp.h"
@@ -54,11 +55,13 @@
int numComp() const;
- ListT<CegoAttrComp>& getAttrCompList();
+ SetT<CegoAttrComp>& getAttrCompSet();
bool setup(const ListT<CegoField>& fl);
bool setup(ListT<CegoField>* joinBuf, int offset, int size);
-
+
+ CegoAttrCond getFilterCond(const ListT<CegoField>& fl) const;
+
IndexMatch checkIndex(const ListT<CegoField>& schema) const;
void setIdxSchema(ListT<CegoField>& schema);
@@ -67,19 +70,23 @@
CegoComparison getPrimaryComparison() const;
void setPrimaryComparison(CegoComparison comp);
- void asConjunctionList(ListT<CegoPredDesc*>& conjunctionList) const;
+ void asConjunctionList(const ListT<CegoExpr*>& exprList, ListT<CegoPredDesc*>& conjunctionList) const;
CegoAttrCond& operator = ( const CegoAttrCond& ac);
bool operator == ( const CegoAttrCond& ac) const;
bool operator != ( const CegoAttrCond& ac) const;
+ friend CegoAttrCond operator + ( const CegoAttrCond& ac1, const CegoAttrCond& ac2);
+
Chain toChain() const;
friend ostream& operator << (ostream& s, const CegoAttrCond& ac);
private:
+ CegoExpr* getExpressionForAlias(const ListT<CegoExpr*>& exprList, const Chain& alias) const;
+
ListT<CegoField> _idxSchema;
- ListT<CegoAttrComp> _attrCompList;
+ SetT<CegoAttrComp> _attrCompSet;
};
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoAttrDesc.cc
^
|
@@ -242,7 +242,7 @@
_tableName = pCO->getName();
refCount++;
}
- else if ( _tableName == Chain() || pCO->getType() == CegoObject::JOIN )
+ else if ( _tableName == Chain() ) // || pCO->getType() == CegoObject::JOIN )
{
CegoField* pF = fl.First();
while (pF)
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoDefs.h
^
|
@@ -40,7 +40,7 @@
#endif
#define CEGO_PRODUCT "Cego"
-#define CEGO_VERSION "2.10.1"
+#define CEGO_VERSION "2.10.2"
#define CEGO_COPYRIGHT "Copyright (C) 2000-2011 by Bjoern Lemke. All rights reserved"
/*******************************/
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoDistCursor.cc
^
|
@@ -230,6 +230,7 @@
_isFirst=true;
_doEval = false;
_idxMatch = CegoAttrCond::INAPP;
+ _isAttrCondValid = false;
if ( _pCO->getType() == CegoObject::VIEW )
{
@@ -260,6 +261,7 @@
if ( attrCond.numComp() == 0 )
return distSetup();
+ _isAttrCondValid = false;
_idxMatch = CegoAttrCond::INAPP;
_isFirst=true;
_doEval = false;
@@ -301,7 +303,6 @@
{
_pDBMng->log(_modId, Logger::DEBUG, Chain("Setting join condition ") + attrCond.toChain());
joinSetup(attrCond);
- // _doEval = true;
}
}
@@ -333,7 +334,7 @@
bool CegoDistCursor::evalCondition(ListT<CegoField>* flArray, int pos, int size)
{
- CegoAttrComp *pAC = _cursorCond.getAttrCompList().First();
+ CegoAttrComp *pAC = _cursorCond.getAttrCompSet().First();
while ( pAC )
{
@@ -411,7 +412,7 @@
throw Exception(EXLOC, msg);
}
}
- pAC = _cursorCond.getAttrCompList().Next();
+ pAC = _cursorCond.getAttrCompSet().Next();
}
return true;
}
@@ -925,64 +926,61 @@
void CegoDistCursor::joinSetup(const CegoAttrCond& attrCond)
{
- _cursorCond = attrCond;
-
CegoJoinObject *pJO = (CegoJoinObject*)_pCO;
ListT<CegoField> aSchema;
ListT<CegoField> bSchema;
+ CegoAttrCond addInnerCond;
+
if ( pJO->getJoinType() == CegoJoinObject::INNER || pJO->getJoinType() == CegoJoinObject::LEFTOUTER )
{
+
bSchema = pJO->getLeftObject()->getSchema();
aSchema = pJO->getRightObject()->getSchema();
+
+ _cursorCond = attrCond.getFilterCond(bSchema);
+ addInnerCond = attrCond.getFilterCond(aSchema);
+
}
else if ( pJO->getJoinType() == CegoJoinObject::RIGHTOUTER )
{
aSchema = pJO->getLeftObject()->getSchema();
- bSchema = pJO->getRightObject()->getSchema();
+ bSchema = pJO->getRightObject()->getSchema();
+
+ _cursorCond = attrCond.getFilterCond(aSchema);
+ addInnerCond = attrCond.getFilterCond(bSchema);
}
CegoAttrCond ac;
CegoQueryHelper qh;
- _isAttrCondValid = qh.evalAttrCond(ac, pJO->getPredDesc(), aSchema, &bSchema, 1, 0);
+ bool predAttrCondValid = qh.evalAttrCond(ac, pJO->getPredDesc(), aSchema, &bSchema, 1, 0);
- ListT<CegoPredDesc*> conjunctionList;
- attrCond.asConjunctionList(conjunctionList);
-
- CegoPredDesc **pPred = conjunctionList.First();
- while ( pPred && _isAttrCondValid )
+ if ( predAttrCondValid )
{
- _isAttrCondValid = qh.evalAttrCond(ac, *pPred, aSchema, &bSchema, 1, 0);
-
- pPred = conjunctionList.Next();
+ _evalPredicate = false;
+ _innerCond = ac + addInnerCond;
+ }
+ else
+ {
+ _evalPredicate = true;
+ _innerCond = addInnerCond;
}
- if ( ac.numComp() == 0 )
- _isAttrCondValid=false;
+ _isAttrCondValid = true;
- if ( _isAttrCondValid )
+ if ( pJO->getJoinType() == CegoJoinObject::INNER || pJO->getJoinType() == CegoJoinObject::LEFTOUTER )
{
- _pDBMng->log(_modId, Logger::DEBUG, Chain("Using join attr cond ") + ac.toChain());
- _innerCond = ac;
- _evalPredicate = false;
-
- if ( pJO->getJoinType() == CegoJoinObject::INNER || pJO->getJoinType() == CegoJoinObject::LEFTOUTER )
- {
- _pTCLeft->distSetup(_cursorCond);
- _pTCRight->distSetup(_innerCond);
- }
- if ( pJO->getJoinType() == CegoJoinObject::RIGHTOUTER )
- {
- _pTCRight->distSetup(_cursorCond);
- _pTCLeft->distSetup(_innerCond);
- }
+ _pTCLeft->distSetup(_cursorCond);
+ _pTCRight->distSetup(_innerCond);
}
- else
+ if ( pJO->getJoinType() == CegoJoinObject::RIGHTOUTER )
{
- _evalPredicate = true;
+ _pTCRight->distSetup(_cursorCond);
+ _pTCLeft->distSetup(_innerCond);
}
+
}
Element* CegoDistCursor::getPlan()
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoExpr.cc
^
|
@@ -331,22 +331,22 @@
return (*this);
}
-Chain CegoExpr::toChain() const
+Chain CegoExpr::toChain(const Chain& indent) const
{
Chain s;
switch ( _expType )
{
case CegoExpr::ADD:
- s = _pExpr->toChain() + " + " + _pTerm->toChain();
+ s = indent + _pExpr->toChain() + " + " + _pTerm->toChain();
break;
case CegoExpr::SUB:
- s = _pExpr->toChain() + " - " + _pTerm->toChain();
+ s = indent + _pExpr->toChain() + " - " + _pTerm->toChain();
break;
case CegoExpr::CONCAT:
- s = _pExpr->toChain() + " | " + _pTerm->toChain();
+ s = indent + _pExpr->toChain() + " | " + _pTerm->toChain();
break;
case CegoExpr::TERM:
- s = _pTerm->toChain();
+ s = indent + _pTerm->toChain();
break;
}
return s;
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoExpr.h
^
|
@@ -87,7 +87,7 @@
CegoExpr& operator = ( const CegoExpr& e);
- Chain toChain() const;
+ Chain toChain(const Chain& indent = Chain("")) const;
Element* toElement() const;
void fromElement(Element *pExpElement, CegoDistManager *pGTM);
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoIndexCursor.cc
^
|
@@ -712,7 +712,7 @@
while ( pF )
{
- CegoAttrComp* pAC = _pAttrCond->getAttrCompList().First();
+ CegoAttrComp* pAC = _pAttrCond->getAttrCompSet().First();
while ( pAC )
{
@@ -756,7 +756,7 @@
}
- pAC = _pAttrCond->getAttrCompList().Next();
+ pAC = _pAttrCond->getAttrCompSet().Next();
}
pF = _idxSchema.Next();
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoPredDesc.cc
^
|
@@ -970,35 +970,35 @@
if (_pC->Left())
{
- s = indent + Chain(" ( ");
+ s = indent + Chain("( ");
s += _pC->Left()->toChain();
s += Chain("\n");
switch(_pC->getCondType())
{
case CegoCondDesc::AND:
- s += indent + Chain(" and ") + Chain("\n");
+ s += indent + Chain(" and") + Chain("\n");
break;
case CegoCondDesc::OR:
- s += indent + Chain(" or ") + Chain("\n");
+ s += indent + Chain(" or") + Chain("\n");
break;
default:
break;
}
s += indent + _pC->Right()->toChain();
- s += Chain(" ) ");
+ s += Chain(" )");
}
break;
}
case CegoPredDesc::NOTPRED:
{
- s = Chain(" not ") + _pNotPred->toChain();
+ s = indent + Chain("not\n") + _pNotPred->toChain(indent);
break;
}
case CegoPredDesc::EXPRCOMP:
{
- s = _pExpr1->toChain();
+ s = indent + _pExpr1->toChain();
switch (_comp)
{
@@ -1028,7 +1028,7 @@
case CegoPredDesc::BETWEEN:
{
- s = _pExpr2->toChain();
+ s = indent + _pExpr2->toChain();
s += Chain(" between ");
s += _pExpr1->toChain();
s += Chain(" and ");
@@ -1038,48 +1038,48 @@
}
case CegoPredDesc::ISLIKE:
{
- s = _pExpr1->toChain();
+ s = indent + _pExpr1->toChain();
s += Chain(" like ");
s += Chain("'") + _pattern + Chain("'");
break;
}
case CegoPredDesc::ISNOTLIKE:
{
- s = _pExpr1->toChain();
+ s = indent + _pExpr1->toChain();
s += Chain(" not like ");
s += Chain("'") + _pattern + Chain("'");
break;
}
case CegoPredDesc::NULLCOMP:
{
- s = _pExpr1->toChain();
+ s = indent + _pExpr1->toChain();
s += Chain(" is null ");
break;
}
case CegoPredDesc::NOTNULLCOMP:
{
- s = _pExpr1->toChain();
+ s = indent + _pExpr1->toChain();
s += Chain(" is not null ");
break;
}
case CegoPredDesc::EXISTSCOMP:
{
- s = " exists " ;
- s += "(" + _pSelect->toChain() + ")";
+ s = indent + Chain("exists (\n");
+ s += indent + _pSelect->toChain(indent) + ")";
break;
}
case CegoPredDesc::INSUB:
{
- s = _pExpr1->toChain();
+ s = indent + _pExpr1->toChain();
s += Chain(" in ");
- s += Chain("(") + _pSelect->toChain() + Chain(")");
+ s += Chain("(") + _pSelect->toChain(indent) + Chain(")");
break;
}
case CegoPredDesc::NOTINSUB:
{
- s = _pExpr1->toChain();
+ s = indent + _pExpr1->toChain();
s += Chain(" not in ");
- s += Chain("(") + _pSelect->toChain() + Chain(")");
+ s += Chain("(") + _pSelect->toChain(indent) + Chain(")");
break;
}
}
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoProcQueryStmt.cc
^
|
@@ -80,6 +80,6 @@
Chain CegoProcQueryStmt::toChain(const Chain& indent) const
{
Chain s;
- s = indent + _pQuery->toChain();
+ s = _pQuery->toChain(indent);
return s;
}
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoQuery.cc
^
|
@@ -702,30 +702,31 @@
return _affCount;
}
-Chain CegoQuery::toChain() const
+Chain CegoQuery::toChain(const Chain& indent) const
{
Chain s;
switch ( _mode )
{
case START_QUERY:
{
- s = Chain("start transaction");
+ s = indent + Chain("start transaction");
break;
}
case COMMIT_QUERY:
{
- s = Chain("commit");
+ s = indent + Chain("commit");
break;
}
case ROLLBACK_QUERY:
{
- s = Chain("rollback");
+ s = indent + Chain("rollback");
break;
}
case INSERT_QUERY:
{
- s = Chain("insert into ") + _tableName;
+
+ s = indent + Chain("insert into ") + _tableName;
if ( _schema.Size() > 0 )
{
@@ -743,7 +744,7 @@
s += Chain(" )");
}
- s += Chain(" values ");
+ s += Chain("\n") + indent + Chain(" values ");
ListT<CegoExpr*> *pExprList = _exprListArray.First();
while ( pExprList )
@@ -769,7 +770,7 @@
case INSERTBYSELECT_QUERY:
{
- s = Chain("insert into ") + _tableName;
+ s = indent + Chain("insert into ") + _tableName;
if ( _schema.Size() > 0 )
{
@@ -787,15 +788,14 @@
s += Chain(" )");
}
- s += Chain(" ");
-
- s += _pSelect->toChain();
+ s += Chain("\n") + indent;
+ s += _pSelect->toChain(indent);
break;
}
case DELETE_QUERY:
{
- s = Chain("delete from ") + _tableName;
+ s = indent + Chain("delete from ") + _tableName;
if ( _tableName != _tableAlias )
s += Chain(" ") + _tableAlias;
@@ -810,7 +810,7 @@
case UPDATE_QUERY:
{
- s = Chain("update ") + _tableName;
+ s = indent + Chain("update ") + _tableName;
if ( _tableName != _tableAlias )
s += Chain(" ") + _tableAlias;
@@ -855,7 +855,7 @@
}
case ALTER_QUERY:
{
- s = Chain("alter ") + _tableName + Chain(" ");
+ s = indent + Chain("alter ") + _tableName + Chain(" ");
CegoAlterDesc *pAD = _alterList.First();
while ( pAD )
{
@@ -868,7 +868,7 @@
}
case RENAME_QUERY:
{
- s = Chain("rename ");
+ s = indent + Chain("rename ");
switch ( _objType )
{
case CegoObject::TABLE:
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoQuery.h
^
|
@@ -76,7 +76,7 @@
long getAffectedCount() const;
- Chain toChain() const;
+ Chain toChain(const Chain& indent) const;
private:
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoSelect.cc
^
|
@@ -628,6 +628,8 @@
void CegoSelect::checkValidRef()
{
+ _pLogger->log(_modId, Logger::DEBUG, Chain("Validating references ..."));
+
ListT<CegoAttrDesc*> attrRefList = getAttrRefList();
CegoAttrDesc **pAD = attrRefList.First();
while ( pAD )
@@ -637,6 +639,9 @@
// cout << "Detected " << (*pAD)->toChain() << " as unknwon" << endl;;
throw Exception(EXLOC, Chain("Unknown attribute :") + (*pAD)->toChain());
}
+
+ _pLogger->log(_modId, Logger::DEBUG, Chain("Validated attribute reference ") + (*pAD)->toChain());
+
pAD = attrRefList.Next();
}
}
@@ -1185,8 +1190,7 @@
_pLogger->log(_modId, Logger::DEBUG, Chain("Setting attrcond = ") + _attrCond[_joinLevel].toChain());
bool doSetup = true;
- // if ( _attrCond[_joinLevel].getCondMode() == CegoAttrCond::ATTR )
- // {
+
if ( _attrCond[_joinLevel].setup(_joinBuf, 0, _joinSize) == false )
{
_pLogger->log(_modId, Logger::DEBUG, Chain("Native attr cond set up failed"));
@@ -1204,7 +1208,6 @@
doSetup = false;
}
}
- // }
if ( doSetup )
{
@@ -1752,22 +1755,30 @@
// provide all selected fields in _joinFields
- _joinPredList.Empty();
+ /*
+
+ joinPredList alread set up in evalTableReferences
+
+ _joinPredList.Empty();
+
+ int i=0;
+ CegoContentObject** pCO = _joinList.First();
+
+ while ( pCO )
+ {
+ if ( (*pCO)->getType() == CegoObject::JOIN )
+ {
+ ((CegoJoinObject*)(*pCO))->getPredList(_joinPredList);
+ }
+ pCO = _joinList.Next();
+ }
+ */
int i=0;
CegoContentObject** pCO = _joinList.First();
+
while ( pCO )
- {
- if ( (*pCO)->getType() == CegoObject::JOIN )
- {
- ((CegoJoinObject*)(*pCO))->getPredList(_joinPredList);
- }
- pCO = _joinList.Next();
- }
-
- pCO = _joinList.First();
- while ( pCO )
{
// pOE->print();
@@ -2257,6 +2268,13 @@
{
refCount += _pPred->evalReferences(pCO, fl);
}
+
+ CegoPredDesc **pJoinPred = _joinPredList.First();
+ while (pJoinPred)
+ {
+ refCount += (*pJoinPred)->evalReferences(pCO, fl);
+ pJoinPred = _joinPredList.Next();
+ }
CegoPredDesc **pP = _viewConjunctionList.First();
while ( pP )
@@ -2296,8 +2314,18 @@
void CegoSelect::evalReferences()
{
+ _joinPredList.Empty();
CegoContentObject** pCO = _coList.First();
-
+ while (pCO)
+ {
+ if ( (*pCO)->getType() == CegoObject::JOIN )
+ {
+ ((CegoJoinObject*)(*pCO))->getPredList(_joinPredList);
+ }
+ pCO = _coList.Next();
+ }
+
+ pCO = _coList.First();
while (pCO)
{
// uncompiled objects are detected here
@@ -2812,7 +2840,7 @@
}
_viewConjunctionList.Empty();
- attrCond.asConjunctionList(_viewConjunctionList);
+ attrCond.asConjunctionList(_exprList, _viewConjunctionList);
cleanUp();
@@ -2828,58 +2856,61 @@
{
Chain s;
- s = indent + Chain("select ");
+ s = indent + Chain("select");
if ( _isDistinct )
- s += Chain("distinct ");
+ s += Chain(" distinct");
if ( _exprList.Size() == 0 )
{
- s += Chain("*");
+ s += Chain(" *\n");
}
else
{
+ s += Chain("\n");
CegoExpr** pExpr = _exprList.First();
while (pExpr)
{
- s += (*pExpr)->toChain();
+ s += (*pExpr)->toChain(indent + Chain(" "));
if ( (*pExpr)->getAlias() != Chain() )
{
s += Chain(" as ") + (*pExpr)->getAlias();
}
pExpr = _exprList.Next();
if ( pExpr )
- s += Chain(",\n") + indent + indent;
+ s += Chain(",\n");
}
}
- s += Chain("\n") + indent + Chain("from ");
+ s += Chain("\n") + indent + Chain("from\n");
-
CegoContentObject** pCO = _coList.First();
while (pCO)
{
- s += (*pCO)->toChain();
+ s += indent + Chain(" ") + (*pCO)->toChain();
pCO = _coList.Next();
if ( pCO )
- s += Chain(",\n") + indent;
+ s += Chain(",\n");
}
+
if (_pPred)
{
- s += Chain("\n") + indent + Chain("where ");
- s += _pPred->toChain();
+ s += Chain("\n");
+ s += indent + Chain("where\n");
+ s += indent + _pPred->toChain(indent + Chain(" "));
+ s += Chain("\n");
}
if (_pGroupList)
{
-
- s += Chain("\n") + indent + Chain("group by ");
+ s += Chain("\n");
+ s += indent + Chain("group by\n") + indent;
CegoAttrDesc **pAttrDesc = _pGroupList->First();
while ( pAttrDesc )
{
- s += (*pAttrDesc)->toChain();
+ s += indent + Chain(" ") + (*pAttrDesc)->toChain();
pAttrDesc = _pGroupList->Next();
if ( pAttrDesc )
s += ",";
@@ -2887,27 +2918,29 @@
if ( _pHaving )
{
- s += Chain("\n") + indent + Chain("having ");
- s += _pHaving->toChain();
+ s += Chain("\n") + indent + Chain("having\n");
+ s += indent + _pHaving->toChain();
}
}
if ( _pNativeOrderList )
{
- s += Chain("\n") + indent + Chain("order by ");
+ s += Chain("\n");
+ s += indent + Chain("order by\n") + indent;
CegoExpr **pExpr = _pNativeOrderList->First();
while ( pExpr )
{
- s += (*pExpr)->toChain();
+ s += (*pExpr)->toChain(indent + Chain(" "));
pExpr = _pNativeOrderList->Next();
if ( pExpr )
s += ",";
- }
+ }
}
if ( _pUnionSelect )
{
- s += indent + Chain(" union all ");
+ s += Chain("\n");
+ s += indent + Chain("union all\n") + indent;
s += _pUnionSelect->toChain(indent);
}
return s;
@@ -3151,6 +3184,24 @@
{
ListT<CegoAttrDesc*> attrList;
+ CegoContentObject** pCO = _coList.First();
+ while ( pCO )
+ {
+ if ( (*pCO)->getType() == CegoObject::JOIN )
+ {
+ ListT<CegoPredDesc*> predList;
+ ((CegoJoinObject*)(*pCO))->getPredList(predList);
+
+ CegoPredDesc **pPred = predList.First();
+ while (pPred)
+ {
+ attrList += (*pPred)->getAttrRefList();
+ pPred = predList.Next();
+ }
+ }
+ pCO = _coList.Next();
+ }
+
CegoExpr** pExpr = _exprList.First();
while (pExpr)
{
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/CegoTableManager.cc
^
|
@@ -1998,7 +1998,7 @@
bool isAffected = false;
CegoAttrComp *pAC = 0;
- pAC = ac.getAttrCompList().First();
+ pAC = ac.getAttrCompSet().First();
while ( pAC )
{
@@ -2016,7 +2016,7 @@
}
}
- pAC = ac.getAttrCompList().Next();
+ pAC = ac.getAttrCompSet().Next();
}
if ( isAffected == true )
|
[-]
[+]
|
Changed |
cego-2.10.2.tar.bz2/src/Makefile.in
^
|
@@ -25,7 +25,7 @@
# LDFLAGS = -static-libgcc
LDFLAGS = -L$(LIBDIR) @LDFLAGS@
# CFLAGS = -I$(INCDIR) @LDFLAGS@
-CFLAGS = -I$(INCDIR) -fPIC @CFLAGS@ @CPPFLAGS@
+CFLAGS = -I$(INCDIR) -O2 -fPIC @CFLAGS@ @CPPFLAGS@
RANLIB = @RANLIB@
CGSHLIBOPT = @CGSHLIBOPT@
WPSHLIBOPT = @WPSHLIBOPT@
|