[-]
[+]
|
Changed |
cego.changes
|
|
[-]
[+]
|
Changed |
cego.spec
^
|
|
[-]
[+]
|
Changed |
cego-2.17.7.tar.bz2/README
^
|
@@ -4,7 +4,7 @@
----
A relational and transactional database system
- Version 2.17.6
+ Version 2.17.7
(C)opyright 2006,2007,2008,2009,2010,2011,2012,2013 by Bjoern Lemke
|
[-]
[+]
|
Changed |
cego-2.17.7.tar.bz2/samples/chkdb/check016.sql
^
|
@@ -5,11 +5,9 @@
create table t1 ( a int, b string(30), c datetime, d float, e string(10));
insert into t1 values ( 1 , 'aXXXbb', sysdate, 3.44, '42');
-
select b from t1;
select trim ( b, 'abc' ) from t1;
-
select d from t1;
select trunc ( d ) from t1;
@@ -22,6 +20,8 @@
select left(b, 3) from t1;
select right(b, 3) from t1;
select b from t1;
+select b + e from t1;
+select b | e from t1;
select getpos(b, 'b') from t1;
select getpos(b, 'b', 1, 1) from t1;
select getpos(b, 'b', 1, 2) from t1;
|
[-]
[+]
|
Added |
cego-2.17.7.tar.bz2/samples/chkdb/check037.sql
^
|
@@ -0,0 +1,40 @@
+--
+-- ### Advanced view aggregation checks
+--
+
+drop if exists view v1;
+drop if exists view v2;
+drop if exists view v3;
+
+drop if exists table t1;
+drop if exists table t2;
+
+create table t1 ( a long, b string(20));
+insert into t1 values ( 1, 'XXX');
+insert into t1 values ( 2, 'YYY');
+insert into t1 values ( 3, 'XXX');
+
+create table t2 ( a int, b int, c string(20));
+insert into t2 values ( 1, 22, 'XXX');
+insert into t2 values ( 2, 44, 'YYY');
+insert into t2 values ( 3, 66, 'XXX');
+
+select count(*) from t1 tx;
+
+select t.a as a,
+( select count(a) from t2 tx) as b from t1 t;
+
+create view v1 as select t.a as a,
+ ( select count(*) from t2 tx) as b from t1 t;
+
+select b from v1;
+
+select sum(a) + sum(b) as mergesum, c from t2 group by c;
+
+create view v3 as select sum(a) + sum(b) as ms, c from t2 group by c;
+
+desc view v3;
+
+select ms from v3;
+
+select case when ms = 4 then 'XXX' else 'YYY' end from v3;
|
[-]
[+]
|
Changed |
cego-2.17.7.tar.bz2/src/CegoAction.cc
^
|
@@ -1416,10 +1416,9 @@
}
}
- try {
-
+ try
+ {
moreTuple = _pSelect->nextTuple(fl);
-
}
catch ( Exception e )
{
@@ -1554,7 +1553,7 @@
doCompile=false;
_pTabMng->getDBMng()->log(_modId, Logger::NOTICE, Chain("View ") + viewName + Chain(" can not be compiled"));
}
-
+
Chain viewStmt = Chain("view ") + viewName + Chain(" as\n") + _pSelect->toChain() + Chain(";");
_pTabMng->createDistView(tableSet, viewName, schema, viewStmt);
@@ -3854,9 +3853,9 @@
}
_pTabMng->getDBMng()->unuseObject(tabSetId, tableName, CegoObject::VIEW, CegoDatabaseManager::SHARED);
-
CegoViewObject *pVO = new CegoViewObject();
_pTabMng->getDistObject(tableSet, tableName, CegoObject::VIEW, *pVO);
+
pVO->setName(tableAlias);
_coList.Insert(pVO);
}
|
[-]
[+]
|
Changed |
cego-2.17.7.tar.bz2/src/CegoCaseCond.cc
^
|
@@ -217,7 +217,8 @@
CegoField CegoCaseCond::evalField() const
{
- CegoField f = CegoField( Chain("CASE CONDITION"), Chain("CASE CONDITION"), Chain("case when ..."), VARCHAR_TYPE, 20 );
+ CegoField cf = _elseExpr->evalField();
+ CegoField f = CegoField( Chain("CASE"), Chain("CASE"), Chain("case when ..."), cf.getType(), cf.getLength());
return f;
}
@@ -233,12 +234,15 @@
{
if ( queryHelper.evalPredicate(0, 0, 0, _fla, 0, _flaSize, *pPredDesc, _pBlock) )
{
+ (*pExpr)->setFieldListArray(_fla, _flaSize);
return (*pExpr)->evalFieldValue();
}
pPredDesc = _predList.Next();
pExpr = _exprList.Next();
}
CegoFieldValue fv;
+
+ _elseExpr->setFieldListArray(_fla, _flaSize);
return _elseExpr->evalFieldValue();
}
|
[-]
[+]
|
Changed |
cego-2.17.7.tar.bz2/src/CegoDefs.h
^
|
@@ -40,7 +40,7 @@
#endif
#define CEGO_PRODUCT "Cego"
-#define CEGO_VERSION "2.17.6"
+#define CEGO_VERSION "2.17.7"
#define CEGO_COPYRIGHT "Copyright (C) 2000-2013 by Bjoern Lemke. All rights reserved"
#define CGEXESHELLVARNAME "CGEXESHELL"
|
[-]
[+]
|
Changed |
cego-2.17.7.tar.bz2/src/CegoDistManager.cc
^
|
@@ -1202,7 +1202,7 @@
catch ( Exception e )
{
_pDBMng->unuseObject(oe.getTabSetId(), oe.getName(), oe.getType(), CegoDatabaseManager::EXCLUSIVE_WRITE);
- throw Exception(EXLOC, "Cannot insert local row", e);
+ throw e;
}
_pDBMng->unuseObject(oe.getTabSetId(), oe.getName(), oe.getType(), CegoDatabaseManager::EXCLUSIVE_WRITE);
}
@@ -1261,7 +1261,7 @@
catch ( Exception e)
{
_pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE);
- throw Exception(EXLOC, "Cannot delete local row", e);
+ throw e;
}
_pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE);
@@ -1358,12 +1358,12 @@
catch ( Exception e )
{
_pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE);
- throw Exception(EXLOC, "Cannot update local row", e);
+ throw e;
}
}
_pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE);
- throw Exception(EXLOC, "Cannot update local row", e);
+ throw e;
}
_pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE);
@@ -1380,7 +1380,7 @@
catch ( Exception e )
{
_pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE);
- throw Exception(EXLOC, "Cannot update table", e);
+ throw e;
}
_pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE);
|
[-]
[+]
|
Changed |
cego-2.17.7.tar.bz2/src/CegoFactor.cc
^
|
@@ -656,7 +656,17 @@
}
case CegoFactor::AGGREGATION:
{
- f = CegoField("AGGR", "AGGR", _pAggr->toChain(), VARCHAR_TYPE, 20 );
+
+ if ( _pAggr->getExpr() )
+ {
+ CegoField af = _pAggr->getExpr()->evalField();
+ f = CegoField("AGGR", "AGGR", _pAggr->toChain(), af.getType(), af.getLength() );
+ }
+ else
+ {
+ // must be count(*)
+ f = CegoField("AGGR", "AGGR", _pAggr->toChain(), INT_TYPE, 4);
+ }
break;
}
case CegoFactor::QUERY:
@@ -715,12 +725,8 @@
{
if ( _flaCached )
{
-
// cout << "Using cached field for " << _pAttrDesc->toChain() << " with pos " << _flaCacheArrayPos << " / " << _flaCacheFieldPos << endl;
-
- // TODO
return _fla[_flaCacheArrayPos][_flaCacheFieldPos].getValue();
-
}
if ( _fla == 0)
{
|
[-]
[+]
|
Changed |
cego-2.17.7.tar.bz2/src/CegoFieldValue.cc
^
|
@@ -1441,10 +1441,9 @@
case VARCHAR_TYPE:
{
Chain s1 = Chain((char*)(_pV));
- Chain s2 = Chain((char*)(fv2._pV));
- Chain* pS = new Chain();
- *pS = s1 + s2;
- CegoFieldValue fv3(_type, *pS, pS->length(), true);
+ Chain s2 = Chain((char*)(fv2._pV));
+ Chain m = s1 + s2;
+ CegoFieldValue fv3(_type, m);
return fv3;
}
case BOOL_TYPE:
|
[-]
[+]
|
Changed |
cego-2.17.7.tar.bz2/src/CegoGroupSpace.cc
^
|
@@ -63,6 +63,8 @@
_aggList = aggList;
_maxOrderSize = maxOrderSize;
_orderSize = 0;
+ _groupSchema.Empty();
+ _aggSchema.Empty();
int id=1;
@@ -77,7 +79,6 @@
pF = schema.Next();
}
-
/* we add count aggregation in any case */
_pCountAgg->setAggregationId(_aggList.Size() + 1);
_aggList.Insert( _pCountAgg );
@@ -159,7 +160,6 @@
pF = addKey.Next();
}
-
CegoGroupNode n(addKey);
CegoGroupNode* pN = _pAVL->Find(n);
if ( pN )
@@ -194,7 +194,6 @@
return _orderSize;
}
-
ListT<CegoField> CegoGroupSpace::initGrouping(ListT<CegoField>& dataTuple)
{
|
[-]
[+]
|
Changed |
cego-2.17.7.tar.bz2/src/CegoQuery.cc
^
|
@@ -221,7 +221,9 @@
}
catch ( Exception e )
{
- throw CegoQueryException(COREOP_EXCEP, EXLOC, Chain("Start transaction failed"), e);
+ Chain msg;
+ e.pop(msg);
+ throw CegoQueryException(COREOP_EXCEP, EXLOC, msg);
}
return Chain("Transaction started");
@@ -235,7 +237,9 @@
}
catch ( Exception e )
{
- throw CegoQueryException(COREOP_EXCEP, EXLOC, Chain("Commit transaction failed"), e);
+ Chain msg;
+ e.pop(msg);
+ throw CegoQueryException(COREOP_EXCEP, EXLOC, msg);
}
Chain msg = Chain(opCount) + Chain(" operations committed");
return msg;
@@ -249,7 +253,9 @@
}
catch ( Exception e )
{
- throw CegoQueryException(COREOP_EXCEP, EXLOC, Chain("Rollback transaction failed"), e);
+ Chain msg;
+ e.pop(msg);
+ throw CegoQueryException(COREOP_EXCEP, EXLOC, msg);
}
Chain msg = Chain(opCount) + Chain(" operations rollbacked");
return msg;
@@ -274,7 +280,9 @@
}
catch ( Exception e )
{
- throw CegoQueryException(INVALID_OBJECT_EXCEP, EXLOC, Chain("Insert failed"), e);
+ Chain msg;
+ e.pop(msg);
+ throw CegoQueryException(INVALID_OBJECT_EXCEP, EXLOC, msg);
}
if ( _schema.isEmpty() )
@@ -385,7 +393,9 @@
}
catch ( Exception e )
{
- throw CegoQueryException(COREOP_EXCEP, EXLOC, Chain("Insert failed"), e );
+ Chain msg;
+ e.pop(msg);
+ throw CegoQueryException(COREOP_EXCEP, EXLOC, msg);
}
pExprList = _exprListArray.Next();
@@ -414,7 +424,9 @@
}
catch ( Exception e )
{
- throw CegoQueryException(INVALID_OBJECT_EXCEP, EXLOC, Chain("Insert by select failed"), e);
+ Chain msg;
+ e.pop(msg);
+ throw CegoQueryException(INVALID_OBJECT_EXCEP, EXLOC, msg);
}
try {
@@ -517,7 +529,9 @@
catch ( Exception e )
{
_pSelect->cleanUp();
- throw CegoQueryException(COREOP_EXCEP, EXLOC, Chain("Insert by select failed"), e);
+ Chain msg;
+ e.pop(msg);
+ throw CegoQueryException(COREOP_EXCEP, EXLOC, msg);
}
return Chain(_affCount) + Chain(" tuples inserted");
@@ -543,7 +557,9 @@
}
catch ( Exception e )
{
- throw CegoQueryException(INVALID_OBJECT_EXCEP, EXLOC, Chain("Delete failed"), e);
+ Chain msg;
+ e.pop(msg);
+ throw CegoQueryException(INVALID_OBJECT_EXCEP, EXLOC, msg);
}
try
@@ -553,7 +569,9 @@
}
catch ( Exception e )
{
- throw CegoQueryException(COREOP_EXCEP, EXLOC, Chain("Delete failed"), e);
+ Chain msg;
+ e.pop(msg);
+ throw CegoQueryException(COREOP_EXCEP, EXLOC, msg);
}
return Chain(_affCount) + Chain(" tuples deleted");
@@ -578,7 +596,9 @@
}
catch ( Exception e )
{
- throw CegoQueryException(INVALID_OBJECT_EXCEP, EXLOC, Chain("Update failed"), e);
+ Chain msg;
+ e.pop(msg);
+ throw CegoQueryException(INVALID_OBJECT_EXCEP, EXLOC, msg);
}
CegoField *pF = _schema.First();
@@ -608,7 +628,9 @@
}
catch ( Exception e )
{
- throw CegoQueryException(COREOP_EXCEP, EXLOC, Chain("Update failed"), e);
+ Chain msg;
+ e.pop(msg);
+ throw CegoQueryException(COREOP_EXCEP, EXLOC, msg);
}
CegoReturnVar **pRV = _retVarList.First();
@@ -650,7 +672,9 @@
}
catch ( Exception e )
{
- throw CegoQueryException(INVALID_OBJECT_EXCEP, EXLOC, Chain("Alter failed"), e);
+ Chain msg;
+ e.pop(msg);
+ throw CegoQueryException(INVALID_OBJECT_EXCEP, EXLOC, msg);
}
try
@@ -662,7 +686,9 @@
}
catch ( Exception e )
{
- throw CegoQueryException(COREOP_EXCEP, EXLOC, Chain("Alter failed"), e);
+ Chain msg;
+ e.pop(msg);
+ throw CegoQueryException(COREOP_EXCEP, EXLOC, msg);
}
return Chain("Table altered");
@@ -689,7 +715,9 @@
}
catch ( Exception e )
{
- throw CegoQueryException(COREOP_EXCEP, EXLOC, Chain("Rename failed"), e);
+ Chain msg;
+ e.pop(msg);
+ throw CegoQueryException(COREOP_EXCEP, EXLOC, msg);
}
return Chain("Object renamed");
|
[-]
[+]
|
Changed |
cego-2.17.7.tar.bz2/src/CegoQueryHelper.cc
^
|
@@ -791,6 +791,12 @@
case CegoAggregation::SUM:
case CegoAggregation::AVG:
{
+ if ( fv.getType() == VARCHAR_TYPE )
+ {
+ Chain msg = Chain("Aggregation not supported on datatype <") + CEGO_TYPE_MAP[ (int) fv.getType()] + Chain(">");
+ throw Exception(EXLOC, msg);
+ }
+
if ( pAgg->getFieldValue().getValue() == 0 )
{
pAgg->getFieldValue() = fv;
|
[-]
[+]
|
Changed |
cego-2.17.7.tar.bz2/src/CegoSelect.cc
^
|
@@ -329,6 +329,15 @@
}
_orderingDone=false;
+
+ if ( _pGroupList )
+ {
+ _groupingDone = false;
+
+ if ( _pGroupSpace )
+ _pGroupSpace->resetGroupSpace();
+
+ }
_isCached = false;
_queryCache.Empty();
@@ -440,7 +449,6 @@
// end of cache clear
-
_isPrepared = true;
if ( _pUnionSelect )
@@ -779,7 +787,7 @@
}
else
{
-
+
if ( _checkUnion == false )
if ( nextAggTuple(jfl) )
{
@@ -868,7 +876,7 @@
}
evalAggregation(jfl);
-
+
_aggDone=true;
return true;
}
@@ -1036,7 +1044,7 @@
bool CegoSelect::nextResultTuple(ListT<CegoField>& jfl, ListT<CegoField>& ofl)
{
-
+
switch ( _selectMode )
{
case PLAIN:
@@ -1087,7 +1095,8 @@
}
(*pExpr)->setFieldListArray( &gfl, 1);
- f.setValue ( (*pExpr)->evalFieldValue() );
+ f.setValue ( (*pExpr)->evalFieldValue() );
+ f.setAttrName((*pExpr)->getAlias());
jfl.Insert(f);
}
else
@@ -1095,13 +1104,12 @@
CegoField f;
f.setId(0);
(*pExpr)->setFieldListArray( &gfl, 1);
- f.setValue((*pExpr)->evalFieldValue() );
+ f.setValue((*pExpr)->evalFieldValue() );
+ f.setAttrName((*pExpr)->getAlias());
jfl.Insert(f);
}
pExpr = _exprList.Next();
}
-
-
return moreTuple;
}
@@ -1336,8 +1344,8 @@
_pTC[_joinLevel]->distSetup();
}
-
/*
+
cout << "NextTuple : Size=" << _joinSize << " NumCO= " << _joinList[_joinLevel]->getSubCOList().Size() << endl;
for ( int i=_joinSize; i<_joinList[_joinLevel]->getSubCOList().Size(); i++)
{
@@ -1351,6 +1359,7 @@
}
else
{
+
/*
cout << "NextTuple : Size=" << _joinSize << " NumCO= " << _joinList[_joinLevel]->getSubCOList().Size() << endl;
for ( int i=_joinSize; i<_joinList[_joinLevel]->getSubCOList().Size(); i++)
@@ -3460,23 +3469,20 @@
CegoExpr** pExpr = _exprList.First();
while ( pExpr )
- {
-
- CegoQueryHelper qh;
-
+ {
+ CegoQueryHelper qh;
qh.aggregateTuple(aggTuple, *pExpr);
-
pExpr = _exprList.Next();
}
}
void CegoSelect::evalAggregation(ListT<CegoField>& resultList)
{
-
+
CegoExpr** pExpr = _exprList.First();
while ( pExpr )
{
-
+
ListT<CegoAggregation*> aggList = (*pExpr)->getAggregationList();
CegoAggregation **pAgg = aggList.First();
@@ -3498,8 +3504,26 @@
pAgg = aggList.Next();
}
-
- resultList.Insert( CegoField((*pExpr)->evalFieldValue()) );
+
+ bool notFound=true;
+ CegoFieldValue fv = (*pExpr)->evalFieldValue();
+
+ // is the aggregation is associated with an alias ?
+ // this may happen for aggregation in views
+ CegoField* pF = resultList.First();
+ while ( pF && notFound )
+ {
+ if ( pF->getAttrName() == (*pExpr)->getAlias() )
+ {
+ pF->setValue(fv);
+ notFound = false;
+ }
+ pF = resultList.Next();
+ }
+
+ // if native aggregation, we add it to list
+ if ( notFound )
+ resultList.Insert(CegoField(fv));
pExpr = _exprList.Next();
}
|
[-]
[+]
|
Changed |
cego-2.17.7.tar.bz2/src/CegoTableManager.cc
^
|
@@ -2107,7 +2107,7 @@
{
free (pBufBase);
}
- throw Exception(EXLOC, Chain("Cannot insert row"), e);
+ throw e;
}
}
@@ -2205,7 +2205,7 @@
catch ( Exception e )
{
delete pTC;
- throw Exception(EXLOC, Chain("Cannot update row"), e);
+ throw e;
}
delete pTC;
@@ -2319,7 +2319,7 @@
{
// now we can release the index root page
delete pTC;
- throw Exception(EXLOC, Chain("Cannot update row"), e);
+ throw e;
}
delete pTC;
@@ -2388,7 +2388,7 @@
catch ( Exception e )
{
delete pTC;
- throw Exception(EXLOC, Chain("Cannot update row"), e);
+ throw e;
}
@@ -2405,7 +2405,7 @@
{
// now we can release the index root page
_pDBMng->bufferUnfix(bp, true, _pLockHandle);
- throw Exception(EXLOC, Chain("Update failed"), e);
+ throw e;
}
_pDBMng->bufferUnfix(bp, true, _pLockHandle);
@@ -2992,7 +2992,7 @@
catch ( Exception e)
{
delete pTC;
- throw e; // Chain("Cannot delete row"), e);
+ throw e;
}
}
else
@@ -3078,7 +3078,7 @@
catch ( Exception e )
{
delete pTC;
- throw Exception(EXLOC, Chain("Cannot delete row"), e);
+ throw e;
}
}
else
@@ -3132,7 +3132,7 @@
catch ( Exception e )
{
delete pTC;
- throw Exception(EXLOC, Chain("Cannot delete row"), e);
+ throw e;
}
}
}
@@ -3203,7 +3203,7 @@
catch ( Exception e )
{
if ( doIgnoreIndexError == false )
- throw Exception(EXLOC, Chain("Cannot delete row"), e);
+ throw e;
}
}
pOE = idxList.Next();
@@ -3236,7 +3236,7 @@
catch ( Exception e )
{
if ( doIgnoreIndexError == false )
- throw Exception(EXLOC, Chain("Cannot delete row"), e);
+ throw e;
}
}
pBTO = btreeList.Next();
@@ -3470,7 +3470,7 @@
catch ( Exception e )
{
delete pTC;
- throw Exception(EXLOC, Chain("Cannot release blob"), e);
+ throw e;
}
}
@@ -4231,7 +4231,7 @@
if ( pC )
pC->abort();
- throw Exception(EXLOC, Chain("Create of foreign key failed"), e);
+ throw e;
}
@@ -4351,7 +4351,7 @@
if ( pC )
pC->abort();
- throw Exception(EXLOC, Chain("Create of check failed"), e);
+ throw e;
}
@@ -5059,7 +5059,7 @@
{
tsLock[tabSetId].unlock();
- throw Exception(e);
+ throw e;
}
tsLock[tabSetId].unlock();
|