summaryrefslogtreecommitdiffstats
path: root/relindexif/test
diff options
context:
space:
mode:
Diffstat (limited to 'relindexif/test')
-rw-r--r--relindexif/test/Makefile97
-rw-r--r--relindexif/test/computedindex.cc109
-rw-r--r--relindexif/test/exportindex.cc234
-rw-r--r--relindexif/test/miteratest.cc53
-rw-r--r--relindexif/test/testindex.pc262
5 files changed, 755 insertions, 0 deletions
diff --git a/relindexif/test/Makefile b/relindexif/test/Makefile
new file mode 100644
index 0000000..b21e636
--- /dev/null
+++ b/relindexif/test/Makefile
@@ -0,0 +1,97 @@
+# -*-Makefile-*-
+#
+# This file is part of rasdaman community.
+#
+# Rasdaman community is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Rasdaman community is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+#
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+# rasdaman GmbH.
+#
+# For more information please see <http://www.rasdaman.org>
+# or contact Peter Baumann via <baumann@rasdaman.com>. # Top Level makefile. This points to the various modules that have to be build
+# and/or deployed
+#
+
+# MAKEFILE FOR:
+# test programs of module relindexif
+#
+#
+# COMMENTS:
+# List environment dependencies, known bugs, specialities etc.
+#
+########################################################################
+
+# standard include with general options
+include $(RMANBASE)/Makefile.inc
+
+CPPSOURCES = testindex.c
+
+# Not needed if BASEDB flag correctly set
+INDEXIF = $(RELINDEXIF)
+
+# all test programs
+ALLTESTS = testindex
+
+# Needed RasDaMan libraries for linking. To be copmpleted.
+#NEEDEDLIBS = $(CACHETAMGR) $(QLPARSER) $(INDEXMGR) $(RELADMINIF) $(RELMDDIF) $(RELBLOBIF) $(RELINDEXIF) $(CACHETAMGR) $(RELCATALOGIF) $(RASLIB) $(RELADMINIF) $(RELMDDIF)
+NEEDEDLIBS = $(RASLIB) $(CLIENTCOMM)
+
+MISCCLEAN := client.bm client.dbg client.log ir.out core
+OBJS := testindex.o miteratest.o
+# some additional flags for compiling and linking
+
+
+############################## Targets #################################
+
+# make all tests
+.PHONY: test
+test: $(ALLTESTS)
+
+# delete object and test programs
+.PHONY: clean
+clean:
+ -rm $(ALLTESTS)
+ -rm *.c
+ -rm *.o
+
+# deletes all non modified, but checked out files
+.PHONY: rcsclean
+rcsclean:
+ -rcsclean
+
+########################### Dependencies ###############################
+
+
+# make all tests
+.PHONY: test
+test: $(ALLTESTS)
+
+# See reladminif/test/Makefile for an example of how to add
+# here test files.
+
+testindex : testindex.o
+testindex.o : testindex.c
+testindex.c : testindex.pc
+
+miteratest : miteratest.o
+ $(PURIFY) $(CXX) $(LDFLAGS) -o miteratest miteratest.o $(RASLIB) ../../mymalloc/mymalloc_cln.o
+miteratest.o : miteratest.cc
+ $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<
+
+computeindex : computedindex.o
+ $(PURIFY) $(CXX) $(LDFLAGS) -o $@ wurzelprungt
+computeindex.o : computedindex.cc
+ $(CXX) -c $(CPPFLAGS) -mt $(CXXFLAGS) $< asdlfkajsd
+
+
diff --git a/relindexif/test/computedindex.cc b/relindexif/test/computedindex.cc
new file mode 100644
index 0000000..0a63254
--- /dev/null
+++ b/relindexif/test/computedindex.cc
@@ -0,0 +1,109 @@
+/*
+* This file is part of rasdaman community.
+*
+* Rasdaman community is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* Rasdaman community is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+*
+* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+rasdaman GmbH.
+*
+* For more information please see <http://www.rasdaman.org>
+* or contact Peter Baumann via <baumann@rasdaman.com>.
+*/
+#include <iostream>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "raslib/rmdebug.hh"
+#include "raslib/rminit.hh"
+#include "raslib/minterval.hh"
+
+RMINITGLOBALS('C')
+
+/*
+ You need to know the defined domain:
+ check if the tile config fits the defined domain
+ check if the requested/inserted tile fits into the defined domain
+ You need to know the tile config:
+ check if the inserted tile has the proper domain
+ You need to know the normalized domain:
+ it is translated to the origin
+ its extent is divided by the extent of the tile config
+ You request a point in the index:
+ the point is translated to the normalized domain
+ the point is normalized (divided by the tile config extent)
+ you get the cell offset of this point from the normalized domain
+ you add the base counter to the cell offset
+ You request a domain in the index
+ the domain is translated to the normalized domain
+ the domain is normalized (divided by the tile config extent)
+ for each point in the resulting domain you do a point query
+*/
+
+r_Minterval
+createNormalizedDomain(const r_Point& mddDomainExtent, const r_Point& tileConfigExtent)
+ {
+ r_Dimension theDim = mddDomainExtent.dimension();
+ r_Minterval normalizedDomain(theDim);
+ r_Range normalized = 0;
+
+ for (r_Dimension dim = 0; dim < theDim; dim++)
+ {
+ normalized = (r_Range)(mddDomainExtent[dim]/tileConfigExtent[dim]) - 1;
+ cout << "mdd domain extent [" << dim << "] " << mddDomainExtent[dim] << endl;
+ cout << "tile config extent [" << dim << "] " << tileConfigExtent[dim] << endl;
+ cout << "division " << mddDomainExtent[dim]/tileConfigExtent[dim] << endl;
+ if ((normalized + 1)* tileConfigExtent[dim] != mddDomainExtent[dim])
+ {
+ cout << "got you" << endl;
+ }
+ normalizedDomain[dim] = r_Sinterval(0, normalized);
+ }
+ return normalizedDomain;
+ }
+
+r_Point
+createNormalizedPoint(const r_Point& toNormalize, const r_Point& tileConfigExtent, const r_Point& mddDomainOrigin)
+ {
+ r_Dimension theDim = mddDomainOrigin.dimension();
+ r_Point normalizedPoint(theDim);
+
+ for (r_Dimension dim = 0; dim < theDim; dim++)
+ {
+ normalizedPoint[dim] = (r_Range)((toNormalize[dim] - mddDomainOrigin[dim])/tileConfigExtent[dim]);
+ }
+ return normalizedPoint;
+ }
+
+void
+main(unsigned int argc, const char** argv)
+ {
+ unsigned int baseCounter = 0;
+ unsigned int entryType = 0;
+ r_Area index = 0;
+
+ r_Minterval tileConfig("[0:1,0:2]");
+
+ r_Minterval mddDomain("[10:21,0:11]");
+
+ r_Point whereToSearch("[11,9]");
+
+ r_Minterval normalizedDomain = createNormalizedDomain(mddDomain.get_extent(), tileConfig.get_extent());
+ cout << "normalized domain " << normalizedDomain << endl;
+
+ r_Point normalizedSearch = createNormalizedPoint(whereToSearch, tileConfig.get_extent(), mddDomain.get_origin());
+ cout << "normalized search " << normalizedSearch << endl;
+ cout << "index of search point " << normalizedDomain.cell_offset(normalizedSearch) << endl;
+
+ }
+
diff --git a/relindexif/test/exportindex.cc b/relindexif/test/exportindex.cc
new file mode 100644
index 0000000..1e4e45b
--- /dev/null
+++ b/relindexif/test/exportindex.cc
@@ -0,0 +1,234 @@
+/*
+* This file is part of rasdaman community.
+*
+* Rasdaman community is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* Rasdaman community is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+*
+* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+rasdaman GmbH.
+*
+* For more information please see <http://www.rasdaman.org>
+* or contact Peter Baumann via <baumann@rasdaman.com>.
+*/
+/*
+get mddoid, iterate domain, dataformat
+
+select mdd
+get domain
+ {
+ begin ta
+ iterate over domain
+ retrieve tiles
+ alter tiles
+ commit ta
+ }
+*/
+
+#ifdef EARLY_TEMPLATE
+#define __EXECUTABLE__
+#include "server/template_inst.hh"
+#endif
+
+#include "reladminif/adminif.hh"
+#include "reladminif/databaseif.hh"
+#include "reladminif/transactionif.hh"
+#include "reladminif/oidif.hh"
+#include "cmlparser.hh"
+#include "relindexif/indexid.hh"
+
+#define ALLDONE 0
+#define ERRORPARSINGCOMMANDLINE 1
+#define DOMAINMISSING 2
+#define OIDMISSING 3
+#define OIDINVALID 4
+#define DOMAINMISMATCH 5
+#define FAILED 6
+#define DOMAININVALID 7
+#define UNKNOWNDATAFORMAT 8
+
+char globalConnectId[256];
+
+RMINITGLOBALS('S')
+
+r_Minterval domain;
+OId oid;
+
+int
+main(int argc, char** argv)
+ {
+ RMInit::logOut.rdbuf(cout.rdbuf());
+ RMInit::dbgOut.rdbuf(cout.rdbuf());
+ int retval = 0;
+ bool import = false;
+ const char* fileName = NULL;
+ CommandLineParser &cmlInter = CommandLineParser::getInstance();
+ CommandLineParameter &clp_help = cmlInter.addFlagParameter('h', "help", "show command line switches");
+ CommandLineParameter &clp_import = cmlInter.addStringParameter('i', "import", "import data");
+
+ CommandLineParameter &clp_connect = cmlInter.addStringParameter(CommandLineParser::noShortName, "connect", "database connect string", "/");
+ CommandLineParameter &clp_oid = cmlInter.addStringParameter(CommandLineParser::noShortName, "oid", "the oid of the mdd to operate on");
+ try {
+ cmlInter.processCommandLine(argc, argv);
+ }
+ catch(CmlException& err)
+ {
+ cmlInter.printHelp();
+ cout << "Error parsing command line:" << endl;
+ cout << err.what() << endl;
+ return ERRORPARSINGCOMMANDLINE;
+ }
+ if (cmlInter.isPresent('h'))
+ {
+ cmlInter.printHelp();
+ return ALLDONE;
+ }
+ if (cmlInter.isPresent("oid"))
+ {
+ oid = OId(atol(cmlInter.getValueAsString("oid")));
+ if (oid.getType() != OId::MDDHIERIXOID)
+ {
+ cout << "oid is not a mdd oid" << endl;
+ return OIDINVALID;
+ }
+ }
+ else {
+ if (cmlInter.isPresent('i'))
+ {
+ import = true;
+ fileName = cmlInter.getValueAsString('i');
+ }
+ else {
+ cout << "oid is missing" << endl;
+ return OIDMISSING;
+ }
+ }
+ strcpy((char*)globalConnectId, cmlInter.getValueAsString("connect"));
+ cout << "connect " << globalConnectId << endl;
+ cout << "set up done" << endl;
+ AdminIf::instance();
+ DatabaseIf d;
+ TransactionIf t;
+ if (import)
+ {
+ std::ifstream i;
+ i.open(fileName);
+ if (i.is_open())
+ {
+ i.seekg(0, std::ios::end);
+ std::streampos end = i.tellg();
+ size_t length = end;
+ BinaryRepresentation brp;
+ brp.binaryLength = length;
+ brp.binaryName = new char[strlen(fileName) + 1];
+ memcpy(brp.binaryName, fileName, strlen(fileName) + 1);
+ brp.binaryData = new char[length];
+ i.seekg(0, std::ios::beg);
+ i.read(brp.binaryData, end);
+ i.close();
+ DBHierIndex* p = new DBHierIndex(0, false, false);
+ p->setBinaryRepresentation(brp);
+ delete [] brp.binaryData;
+ brp.binaryData = NULL;
+ delete [] brp.binaryName;
+ brp.binaryName = NULL;
+ p->printStatus();
+ try {
+ d.open("RASBASE");
+ t.begin(&d, false);
+ ObjectBroker::registerDBObject(p);
+ t.commit();
+ d.close();
+ }
+ catch (const r_Error& e)
+ {
+ cout << "Caught exception " << e.get_errorno() << " " << e.what() << endl;
+ try {
+ t.abort();
+ }
+ catch (const r_Error& ee)
+ {
+ cout << "Caugh exception while aborting " << ee.get_errorno() << " " << ee.what() << endl;
+ try {
+ t.abort();
+ }
+ catch (const r_Error& eee)
+ {
+ cout << "Caugh exception while 2nd aborting " << eee.get_errorno() << " " << eee.what() << endl;
+ }
+ }
+ try {
+ d.close();
+ }
+ catch (const r_Error& eeee)
+ {
+ cout << "Caugh exception while closing " << eeee.get_errorno() << " " << eeee.what() << endl;
+ }
+ return FAILED;
+ }
+ }
+ else {
+ cout << "Unable to open file " << fileName << endl;
+ }
+ }
+ else {
+ try {
+ d.open("RASBASE");
+ t.begin(&d, true);
+ DBHierIndexId index(oid);
+ BinaryRepresentation bin = index->getBinaryRepresentation();
+ index->printStatus();
+ std::ofstream o;
+ o.open(bin.binaryName);
+ if (o.is_open())
+ {
+ o.write(bin.binaryData, bin.binaryLength);
+ o.flush();
+ o.close();
+ }
+ else {
+ cout << "Unable to open file " << bin.binaryName << endl;
+ }
+ delete [] bin.binaryName;
+ delete [] bin.binaryData;
+ t.commit();
+ d.close();
+ }
+ catch (const r_Error& e)
+ {
+ cout << "Caught exception " << e.get_errorno() << " " << e.what() << endl;
+ try {
+ t.abort();
+ }
+ catch (const r_Error& ee)
+ {
+ cout << "Caugh exception while aborting " << ee.get_errorno() << " " << ee.what() << endl;
+ try {
+ t.abort();
+ }
+ catch (const r_Error& eee)
+ {
+ cout << "Caugh exception while 2nd aborting " << eee.get_errorno() << " " << eee.what() << endl;
+ }
+ }
+ try {
+ d.close();
+ }
+ catch (const r_Error& eeee)
+ {
+ cout << "Caugh exception while closing " << eeee.get_errorno() << " " << eeee.what() << endl;
+ }
+ return FAILED;
+ }
+ }
+ return retval;
+ }
diff --git a/relindexif/test/miteratest.cc b/relindexif/test/miteratest.cc
new file mode 100644
index 0000000..f76f461
--- /dev/null
+++ b/relindexif/test/miteratest.cc
@@ -0,0 +1,53 @@
+/*
+* This file is part of rasdaman community.
+*
+* Rasdaman community is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* Rasdaman community is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+*
+* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+rasdaman GmbH.
+*
+* For more information please see <http://www.rasdaman.org>
+* or contact Peter Baumann via <baumann@rasdaman.com>.
+*/
+#include <iostream>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "raslib/rmdebug.hh"
+#include "raslib/rminit.hh"
+#include "raslib/minterval.hh"
+#include "raslib/mitera.hh"
+
+RMINITGLOBALS('C')
+
+
+void
+main(unsigned int argc, const char** argv)
+ {
+ r_Minterval indexDomain("[0:99,0:99]");
+ cout << "index " << indexDomain << endl;
+ r_Minterval iterationDomain("[0:0,0:0]");
+ cout << "iterd " << iterationDomain << endl;
+ r_Minterval iterationResult(2);
+ //r_MiterArea iter(&indexDomain, &iterationDomain);
+ r_MiterArea iter(&iterationDomain, &indexDomain);
+ unsigned int i = 0;
+ while (!iter.isDone())
+ {
+ i++;
+ cout << iter.nextArea() << endl;
+ }
+ cout << " i is " << i << endl;
+ }
+
diff --git a/relindexif/test/testindex.pc b/relindexif/test/testindex.pc
new file mode 100644
index 0000000..df867aa
--- /dev/null
+++ b/relindexif/test/testindex.pc
@@ -0,0 +1,262 @@
+/*
+* This file is part of rasdaman community.
+*
+* Rasdaman community is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* Rasdaman community is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+*
+* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+rasdaman GmbH.
+*
+* For more information please see <http://www.rasdaman.org>
+* or contact Peter Baumann via <baumann@rasdaman.com>.
+*/
+#include "mymalloc/mymalloc.h"
+#include <iostream>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "adminif.hh"
+#include "transactionif.hh"
+#include "databaseif.hh"
+#include "raslib/rmdebug.hh"
+#include "indexmgr/mddstorage.hh"
+#include "raslib/mddtypes.hh"
+#include "oidif.hh"
+#include "inlineminterval.hh"
+#include "externs.h"
+
+
+
+RMINITGLOBALS('C')
+
+unsigned int size = 0;
+r_Dimension dimension = 0;
+MDDStorage::IndexType myType = 0;
+int _isNode = 0;
+OId myOId = (double)0;
+OId parent = (double)0;
+
+void
+readFromDb()
+ {
+ RMDBGOUT(8, "(relindexif)" << "\tDBHierIndex::readFromDb() " << myOId);
+ EXEC SQL BEGIN DECLARE SECTION;
+ double id1;
+ double parentid1;
+ short indextype1;
+ long dimension1;
+ long size1;
+ short indexsubtype1;
+ short lowerfind;
+ struct {
+ short length;
+ char data[3990];
+ } dyndata1;
+ short dyndataind1;
+ EXEC SQL END DECLARE SECTION;
+
+ id1 = myOId;
+
+ EXEC SQL SELECT
+ IndexType,
+ NumEntries,
+ Dimension,
+ ParentOId,
+ IndexSubType
+ INTO
+ :indextype1,
+ :size1,
+ :dimension1,
+ :parentid1,
+ :indexsubtype1
+ FROM
+ RAS_HIERIX
+ WHERE
+ MDDObjIxOId = :id1;
+ if (SQLCODE != 0)
+ {
+ check("DBHierIndex::readFromDb() RAS_HIERIX\0");
+ if (SQLCODE == 100)
+ throw r_Error(r_Error::r_Error_ObjectUnknown);
+ else
+ throw r_Error(r_Error::r_Error_BaseDBMSFailed);
+ }
+
+ switch (indextype1)
+ {
+ case 0:
+ myType = MDDStorage::AutoIx;
+ break;
+ case 1:
+ myType = MDDStorage::DirTilesIx;
+ break;
+ case 2:
+ myType = MDDStorage::RegDirIx;
+ break;
+ case 3:
+ myType = MDDStorage::RPlusTreeNode;
+ break;
+ case 4:
+ myType = MDDStorage::RegRPlusTreeNode;
+ break;
+ default:
+ RMDBGOUT(0, "DBHierIndex::readFromDb() UNKNOWN INDEXTYPE " << indextype1 << "\t " << myOId << " " << myOId.getType());
+ break;
+ }
+ cout << "myType\t\t" << myType << endl;
+
+ size = size1;
+
+ cout << "size\t\t" << size << endl;
+
+ _isNode = indexsubtype1;
+
+ cout << "node\t\t" << _isNode << endl;
+
+ dimension = dimension1;
+
+ cout << "dimension\t\t" << dimension << endl;
+
+ if (parentid1)
+ parent = OId(parentid1);
+ else
+ parent = OId(0, OId::INVALID);
+
+ cout << "parent\t\t" << parent << " " << parent.getIdAsLong() << " " << parent.getType() << endl;
+
+ //number of bytes for bounds for "size" entries and mydomain
+ unsigned long boundssize = sizeof(r_Range) * (size + 1) * dimension;
+ //number of bytes for fixes for "size" entries and mydomain
+ unsigned long fixessize = sizeof(char) * (size + 1) * dimension;
+ //number of bytes for ids of entries
+ unsigned long idssize = sizeof(OId::Id) * size;
+ //number of bytes for types of entries
+ unsigned long typessize = sizeof(char) * size;
+ //number of bytes for the dynamic data
+ unsigned long completesize = boundssize * 2 + fixessize * 2 + idssize + typessize;
+
+ char* completebuffer = (char*)mymalloc(completesize);
+ r_Range* upperboundsbuf = (r_Range*)mymalloc(boundssize);
+ r_Range* lowerboundsbuf = (r_Range*)mymalloc(boundssize);
+ char* upperfixedbuf = (char*)mymalloc(fixessize);
+ char* lowerfixedbuf = (char*)mymalloc(fixessize);
+ OId::Id* entryidsbuf = (OId::Id*)mymalloc(idssize);
+ char* entrytypesbuf = (char*)mymalloc(typessize);
+
+ RMDBGOUT(8, "(relindexif)" << "\t\tcomplete " << completesize << " bounds " << boundssize << " fixes " << fixessize << " ids " << idssize << " types " << typessize);
+ //counter which keeps track of the bytes that have been read from the db
+ unsigned long bytesdone = 0;
+ //counter which keeps track of the bytes that have to be read from the db
+ unsigned long bytestogo = 0;
+
+ int i = 0;
+ currentDbRows = 0;
+
+ EXEC SQL DECLARE C CURSOR FOR
+ SELECT
+ DynData
+ FROM
+ RAS_HIERIXDYN
+ WHERE
+ MDDObjIxOId = :id1
+ ORDER BY
+ Count;
+
+ EXEC SQL OPEN C;
+
+ do {
+ EXEC SQL FETCH C INTO :dyndata1 :dyndataind1;
+ if (SQLCODE != 0)
+ {
+ if (SQLCODE != 100)
+ {
+ check("DBHierIndex::readFromDb() FETCH\0");
+ RMDBGOUT(7, "(relindexif)" << "\t\tSQLCODE " << SQLCODE);
+ free(upperboundsbuf);
+ free(lowerboundsbuf);
+ free(upperfixedbuf);
+ free(lowerfixedbuf);
+ free(entryidsbuf);
+ free(entrytypesbuf);
+ free(completebuffer);
+
+ throw r_Error(r_Error::r_Error_BaseDBMSFailed);
+ }
+ break;
+ }
+ RMDBGOUT(7, "(relindexif)" << "\t\tbytes allready read " << bytesdone << " bytes read now " << dyndata1.length);
+ memcpy(&completebuffer[bytesdone], dyndata1.data, dyndata1.length);
+ bytesdone = dyndata1.length + bytesdone;
+ currentDbRows = currentDbRows + 1;
+ }
+ while (1);
+
+ //all dynamic data is in completebuffer
+ //put that stuff in the correct buffers
+ memcpy(lowerboundsbuf, completebuffer, boundssize);
+ memcpy(upperboundsbuf, &completebuffer[boundssize], boundssize);
+ memcpy(lowerfixedbuf, &completebuffer[boundssize * 2], fixessize);
+ memcpy(upperfixedbuf, &completebuffer[boundssize * 2 + fixessize], fixessize);
+ memcpy(entryidsbuf, &completebuffer[boundssize * 2 + fixessize * 2], idssize);
+ memcpy(entrytypesbuf, &completebuffer[boundssize * 2 + fixessize * 2 + idssize], typessize);
+ //all dynamic data is in its buffer
+ free (completebuffer);
+
+ //rebuild the attributes from the buffers
+ myDomain = InlineMinterval(dimension, &(lowerboundsbuf[0]), &(upperboundsbuf[0]), &(lowerfixedbuf[0]), &(upperfixedbuf[i*dimension]));
+ cout << "myDomain\t\t" << myDomain << endl;
+
+ for (i = 0; i < size; i++)
+ {
+ domainList.push_back(InlineMinterval(dimension, &(lowerboundsbuf[(i+1)*dimension]), &(upperboundsbuf[(i+1)*dimension]), &(lowerfixedbuf[(i+1)*dimension]), &(upperfixedbuf[(i+1)*dimension])));
+ entryOIdList.push_back(OId(entryidsbuf[i], (OId::OIdType)entrytypesbuf[i]));
+ RMDBGOUT(8, "(relindexif)" << "\t\tentry " << entryidsbuf[i] << " " << (OId::OIdType)entrytypesbuf[i] << " at " << InlineMinterval(dimension, &(lowerboundsbuf[(i+1)*dimension]), &(upperboundsbuf[(i+1)*dimension]), &(lowerfixedbuf[(i+1)*dimension]), &(upperfixedbuf[(i+1)*dimension])));
+ }
+
+ free(upperboundsbuf);
+ free(lowerboundsbuf);
+ free(upperfixedbuf);
+ free(lowerfixedbuf);
+ free(entryidsbuf);
+ free(entrytypesbuf);
+ EXEC SQL CLOSE C;
+ RMDBGOUT(8, "(relindexif)" << "\t\tDBHierIndex::readFromDb() END " << myOId);
+ }
+
+int
+main(int argc, char** argv)
+ {
+ AdminIf* myAdmin = AdminIf::instance();
+ DatabaseIf database;
+ TransactionIf ta;
+
+ if (!myAdmin)
+ {
+ cout << "Error at connecting " << endl;
+ cout << "Goodbye "<< endl;
+ exit (-1);
+ }
+
+ if (!database.open("RASBASE"))
+ {
+ cout << "could not open database" << endl;
+ }
+ if (argc == 2)
+ {
+ myOId = (double)a2l(argv[1]);
+ cout << "myOId " << myOId << endl;
+ readFromDb();
+ }
+ }
+
+