summaryrefslogtreecommitdiffstats
path: root/relindexif/dbrcindexds.pgc
blob: a4769209d9f84c2192e880d8c0c798bfb5e4bf77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
#include "mymalloc/mymalloc.h"

/*
* 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>.
*/
/*************************************************************
 *
 *
 * PURPOSE:
 *   Code with embedded SQL for PostgreSQL DBMS
 *
 *
 * COMMENTS:
 * - attribute name 'OId' -> 'UOId' (for UDFs), 'OId' -> 'Id' (for IXs)
 *   to avoid PG name clash with attr type
 *
 ************************************************************/

// PG stuff:
#include "libpq-fe.h"           /* C interface to PgSQL */
#include "libpq/libpq-fs.h"     /* large object (lo) api */

#include "debug-srv.hh"

#include "dbrcindexds.hh"
#include "reladminif/sqlerror.hh"
#include "raslib/rmdebug.hh"

// general embedded SQL related definitions
EXEC SQL include "../reladminif/sqlglobals.h";

// container size for index node
// BEWARE: keep these parameters always consistent!
#define BYTES_PER_TUPLE 3990
EXEC SQL define SQL_BYTES_PER_TUPLE 3991;

// libpg connection maintenance
extern PGconn *pgConn;

r_Bytes
DBRCIndexDS::BytesPerTupel = BYTES_PER_TUPLE;

void
DBRCIndexDS::insertInDb() throw (r_Error)
{
	RMDBGENTER(5, RMDebug::module_indexif, "DBRCIndexDS", "insertInDb() " << myOId);
	ENTER( "DBRCIndexDS::insertInDb" );

#ifdef NOTYET   // should be in future
/*
	EXEC SQL BEGIN DECLARE SECTION;
*/
#endif //NOTYET
		double	id2;
		short	count2;
		Oid	blobOid;
		char	pgQuery[SQL_QUERY_BUFFER_SIZE];		// prelim
		PGresult *pgResult = NULL;			// prelim
#ifdef NOTYET   // should be in future
/*
	EXEC SQL END DECLARE SECTION;
*/
#endif //NOTYET

	// alternative solution for now:

	// (1) --- prepare buffer
	id2 = myOId;
	r_Dimension dimension = myDomain.dimension();
	
	//number of bytes for bounds in 1 minterval
	r_Bytes boundssize = sizeof(r_Range) * dimension;
	//number of bytes for fixes in 1 minterval
	r_Bytes fixessize = sizeof(char) * dimension;
	//number of bytes for the dynamic data
	r_Bytes completesize = sizeof(r_Dimension) + sizeof(short) + sizeof(OId::OIdCounter) + sizeof(unsigned int) + boundssize * 2 + fixessize * 2;

	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);

	RMDBGMIDDLE(8, RMDebug::module_indexif, "DBRCIndexDS", "complete " << completesize << " bounds " << boundssize << " fixes " << fixessize);
	TALK( "DBRCIndexDS: complete " << completesize << " bounds " << boundssize << " fixes " << fixessize);

	// insert myDomain in buffers
	myDomain.insertInDb(&(lowerboundsbuf[0]), &(upperboundsbuf[0]), &(lowerfixedbuf[0]), &(upperfixedbuf[0]));
	RMDBGMIDDLE(5, RMDebug::module_indexif, "DBRCIndexDS", "domain " << myDomain << " stored as " << InlineMinterval(dimension, &(lowerboundsbuf[0]), &(upperboundsbuf[0]), &(lowerfixedbuf[0]), &(upperfixedbuf[0])));
	TALK( "DBRCIndexDS: domain " << myDomain << " stored as " << InlineMinterval(dimension, &(lowerboundsbuf[0]), &(upperboundsbuf[0]), &(lowerfixedbuf[0]), &(upperfixedbuf[0])) );

	char* insertionpointer = completebuffer;
	// write the buffers in the complete buffer
	// this indirection is neccessary because of memory alignment of longs...
	// insert dimension
	memcpy(insertionpointer, &dimension, sizeof(r_Dimension));
	insertionpointer = insertionpointer + sizeof(r_Dimension);

	// insert oid type
	memcpy(insertionpointer, &myBaseOIdType, sizeof(short));
	insertionpointer = insertionpointer + sizeof(short);

	// insert oid counter
	memcpy(insertionpointer, &myBaseCounter, sizeof(OId::OIdCounter));
	insertionpointer = insertionpointer + sizeof(OId::OIdCounter);

	// insert oid counter
	memcpy(insertionpointer, &mySize, sizeof(unsigned int));
	insertionpointer = insertionpointer + sizeof(unsigned int);

	// insert domains
	memcpy(insertionpointer, lowerboundsbuf, boundssize);
	insertionpointer = insertionpointer + boundssize;
	free(lowerboundsbuf);

	memcpy(insertionpointer, upperboundsbuf, boundssize);
	insertionpointer = insertionpointer + boundssize;
	free(upperboundsbuf);

	memcpy(insertionpointer, lowerfixedbuf, fixessize);
	insertionpointer = insertionpointer + fixessize;
	free(lowerfixedbuf);

	memcpy(insertionpointer, upperfixedbuf, fixessize);
	free(upperfixedbuf);

#ifdef RMANDEBUG        // dump low-level blob byte string
{
        char printbuf[10000];
        (void) sprintf( printbuf, "DBRCIndexDS::insertInDb(): [%d]", completesize );
#if 0	// extra verbose output: dump buffer
        char bytebuf[3];
        for (unsigned int i = 0; i < completesize; i++)
        {
                (void) sprintf( bytebuf, " %2X", (unsigned char) completebuffer[i] );
                strcat( printbuf, bytebuf );
        }
#endif // 0
        TALK( printbuf );
}
#endif //RMANDEBUG

	// (2) --- create, open, write, close blob; generates new 'oid' for subsequent storage in tuple
	TALK( "lo_creat()" );
	blobOid = lo_creat( pgConn, INV_READ|INV_WRITE );      // create -- not clear what INV_* here means so indicate all
	if (blobOid == 0)
	{
		free(completebuffer);
		completebuffer = NULL;
		RMInit::logOut << "DBRCIndexDS::insertInDb() cannot create blob, error: " << PQerrorMessage(pgConn) << endl;
		LEAVE( "DBRCIndexDS::insertInDb(pgConn)" );
		generateException();
	}
	TALK( "lo_open() for oid " << blobOid );
	int fd = lo_open( pgConn, blobOid, INV_WRITE );	 // no error code indicated, 0 seems to be no error
	TALK( "lo_write() for fd " << fd << " with " << completesize << " bytes" );
	int loResult = lo_write( pgConn, fd, completebuffer, completesize );
	if (loResult < 0)
	{
		free(completebuffer);
		completebuffer = NULL;
		RMInit::logOut << "DBRCIndexDS::insertInDb() cannot write blob, error: " << PQerrorMessage(pgConn) << endl;
		LEAVE( "DBRCIndexDS::insertInDb() cannot write blob, error " << PQerrorMessage(pgConn) );
		generateException();
	}
	else if (loResult != completesize)		// did not get all
	{
		free(completebuffer);
		completebuffer = NULL;
		RMInit::dbgOut << "BLOB (" << myOId << ") insert: wrote " << loResult << " instead of " << completesize << " bytes" << endl;
		LEAVE( "DBRCIndexDS::insertInDb() wrote " << loResult << " instead of " << completesize << " bytes" );
		generateException();
	}
	TALK( "lo_close(), " << completesize << " bytes written" );
	loResult = lo_close( pgConn, fd );
	if (loResult < 0)				// can't close, don't know if data are written
	{
		free(completebuffer);
		completebuffer = NULL;
		RMInit::logOut << "DBRCIndexDS::insertInDb() ignoring lo_close() error: " << PQerrorMessage(pgConn) << endl;
		LEAVE( "DBRCIndexDS::insertInDb() cannot lo_close(): " << PQerrorMessage(pgConn) );
		generateException();
	}
	free(completebuffer);

	// (3) --- insert HIERIX tuple into db
	count2 = 0;	// we only have one entry
#ifdef NOTYET   // should be in future
/*
	TALK( "EXEC SQL INSERT INTO RAS_RCINDEXDYN ( Id, Count, DynData ) VALUES ( " << id2 << "," << count2 << "," << blobOid << " )" );
	EXEC SQL INSERT INTO RAS_RCINDEXDYN ( Id, Count, DynData )
		VALUES ( :id2, :count2, :blobOid );
	if (SQLCODE != SQLOK)
	{
		check("DBRCIndexDS::insertInDb() insert into RAS_HIERIXDYN\0");
		LEAVE( "DBRCIndexDS::insertInDb(): db access error: " << SQLCODE );
		generateException();
	}
*/
#endif // NOTYET
	// alternative solution for now:
	(void) snprintf( pgQuery, (size_t) sizeof(pgQuery), "INSERT INTO RAS_RCINDEXDYN ( Id, Count, DynData ) VALUES ( %f, %d, %d )", id2, count2, blobOid );
	TALK( pgQuery );
	pgResult = PQexec( pgConn, pgQuery );
	if (PQresultStatus(pgResult) != PGRES_COMMAND_OK)
	{
		LEAVE( "DBRCIndexDS::insertInDb() libpq 'insert RAS_HIERIX' error: " << PQerrorMessage(pgConn) );
		PQclear( pgResult );
		generateException();
	}
	PQclear( pgResult );

	// (4) --- dbobject insert
	DBObject::insertInDb();

	LEAVE( "DBRCIndexDS::insertInDb" );
	RMDBGEXIT(5, RMDebug::module_indexif, "DBRCIndexDS", "insertInDb() " << myOId);
}

void
DBRCIndexDS::readFromDb() throw (r_Error)
{
	RMDBGENTER(5, RMDebug::module_indexif, "DBRCIndexDS", "readFromDb() " << myOId);
	ENTER( "DBRCIndexDS::readFromDb" );

#ifdef RMANBENCHMARK
	DBObject::readTimer.resume();
#endif

#ifdef NOTYET   // should be in future
/*
	EXEC SQL BEGIN DECLARE SECTION;
*/
#endif //NOTYET
		double	id1;
		Oid	blobOid;
		char pgQuery[SQL_QUERY_BUFFER_SIZE];		// prelim
		PGresult *pgResult = NULL;	// prelim
#ifdef NOTYET   // should be in future
/*
	EXEC SQL END DECLARE SECTION;
*/
#endif //NOTYET

	// (1) --- prepare variables
	id1 = myOId;

	// (2) --- get tuple
#ifdef NOTYET   // should be in future
/*
	TALK( "EXEC SQL SELECT DynData FROM RAS_RCINDEXDYN WHERE Id = " << id1 );
	EXEC SQL SELECT DynData FROM RAS_RCINDEXDYN WHERE Id = :id1;
	if (SQLCODE != SQLOK)
	{
		check("DBRCIndexDS::readFromDb() select from RAS_RCINDEXDYN");
		LEAVE("DBRCIndexDS::readFromDb() 'select from RAS_RCINDEXDYN' error: " << SQLCODE );
		generateException();
	}
*/
#endif // NOTYET
	// alternative solution for now:
	(void) snprintf( pgQuery, (size_t) sizeof(pgQuery), "SELECT DynData FROM RAS_RCINDEXDYN WHERE Id = %f", id1 );
	TALK( pgQuery );
	pgResult = PQexec( pgConn, pgQuery );
	if (PQresultStatus(pgResult) != PGRES_TUPLES_OK)
	{
		LEAVE( "DBRCIndexDS::readFromDb() libpq 'insert RAS_HIERIX' error: " << PQerrorMessage(pgConn) );
		PQclear( pgResult );
		generateException();
	}
	blobOid = atoi( PQgetvalue( pgResult, 0, 0 ) );		// extract value from result
	PQclear( pgResult );

	// (3) --- open, read, close blob
	TALK( "lo_open()" );
	int fd = lo_open( pgConn, blobOid, INV_READ );		// open; manual tells no error indication
	TALK( "lo_lseek() end" );
	int blobSize = lo_lseek( pgConn, fd, 0, SEEK_END );	// determine blob size; FIXME: more efficient method??
	TALK( "lo_lseek() start" );
	(void) lo_lseek( pgConn, fd, 0, SEEK_SET );		// rewind for reading
	char* completebuffer = (char*)mymalloc(blobSize);	// receives blob contents
	if (completebuffer == NULL)
	{
		RMInit::logOut << "DBRCIndexDS::readFromDb() cannot allocate blob buffer" << endl;
		LEAVE( "DBRCIndexDS::readFromDb: cannot allocate blob buffer" );
		throw r_Error( r_Error::r_Error_MemoryAllocation );
	}
	TALK( "lo_read() for " << blobSize << " bytes" );	// read blob
	int loResult = lo_read( pgConn, fd, completebuffer, blobSize );
	if (loResult < 0)
	{
		RMInit::logOut << "DBRCIndexDS::readFromDb() cannot read blob, error: " << loResult << endl;
		LEAVE( "DBRCIndexDS::readFromDb: cannot read blob, error " << loResult );
		throw r_Error( r_Error::r_Error_BaseDBMSFailed );
	}
	else if (loResult != blobSize)				// did not get all
	{
		RMInit::dbgOut << "BLOB (" << myOId << ") read: want to read (" << blobSize << " bytes, but got " << loResult << " bytes" << endl;
		LEAVE( "DBRCIndexDS::readFromDb: want to read " << blobSize << " bytes, but got " << loResult << " bytes" );
		throw r_Error( r_Error::r_Error_LimitsMismatch );
	}
	TALK( "lo_close()" );
	int ignoredPgResult = lo_close( pgConn, fd );		// close blob
	if (ignoredPgResult < 0)				// we note, but ignore errors, as we have the data
	{
		RMInit::logOut << "DBRCIndexDS::readFromDb() ignoring lo_close() error: " << ignoredPgResult << endl;
		TALK( "DBRCIndexDS::readFromDb: ignoring lo_close() error: " << ignoredPgResult );
	}

#ifdef RMANDEBUG        // dump low-level blob byte string
{
        char printbuf[10000];
        (void) sprintf( printbuf, "XXX DBRCIndexDS::readFromDb(): [%d]", blobSize );
        char bytebuf[3];
        for (unsigned int i = 0; i < blobSize; i++)
        {
                (void) sprintf( bytebuf, " %2X", (unsigned char) completebuffer[i] );
                strcat( printbuf, bytebuf );
        }
        TALK( printbuf );
}
#endif // RMANDEBUG

	// (4) --- fill variables and buffers
	r_Dimension dimension = 0;
	(void) memcpy(&dimension, completebuffer, sizeof(r_Dimension));
	unsigned int bytesdone = sizeof(r_Dimension);

	(void) memcpy(&myBaseOIdType, &(completebuffer[bytesdone]), sizeof(short));
	bytesdone += sizeof(short);
	(void) memcpy(&myBaseCounter, &(completebuffer[bytesdone]), sizeof(OId::OIdCounter));
	bytesdone += sizeof(OId::OIdCounter);
	(void) memcpy(&mySize, &(completebuffer[bytesdone]), sizeof(unsigned int));
	bytesdone += sizeof(unsigned int);

	r_Bytes boundssize = sizeof(r_Range) * dimension;	//number of bytes for bounds in 2 domains
	r_Bytes fixessize = sizeof(char) * dimension;		//number of bytes for fixes in 2 domains
	r_Bytes completesize = boundssize * 2 + fixessize * 2;	//number of bytes for the dynamic data
	char *dynamicBuffer = &completebuffer[bytesdone];	// ptr to start of dynamic part of buffer

	// additional plausi check
	if (blobSize != bytesdone + completesize)
	{
		RMInit::logOut << "DBRCIndexDS::readFromDb() blob size inconsistency: blobSize (" << blobSize << " != bytesdone (" << bytesdone << ") + completesize (" << completesize << ")";
		TALK( "DBRCIndexDS::readFromDb() blob size inconsistency: blobSize (" << blobSize << " != bytesdone (" << bytesdone << ") + completesize (" << completesize << ")" );
		throw r_Error( r_Error::r_Error_LimitsMismatch );
	}

	RMDBGMIDDLE(7, RMDebug::module_indexif, "DBRCIndexDS", "dimension " << dimension << ", base oid type " << myBaseOIdType << ", base counter " << myBaseCounter << ", size " << mySize << ", complete data size " << 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);

	// all dynamic data is in dynamicBuffer
	// put that stuff in the correct buffers
	memcpy(lowerboundsbuf, dynamicBuffer, boundssize);
	memcpy(upperboundsbuf, &dynamicBuffer[boundssize], boundssize);
	memcpy(lowerfixedbuf, &dynamicBuffer[boundssize * 2], fixessize);
	memcpy(upperfixedbuf, &dynamicBuffer[boundssize * 2 + fixessize], fixessize);

	// all dynamic data is in its buffer
	free (completebuffer);
	dynamicBuffer = completebuffer = NULL;

	// rebuild attributes from buffers
	myDomain = InlineMinterval(dimension, &(lowerboundsbuf[0]), &(upperboundsbuf[0]), &(lowerfixedbuf[0]), &(upperfixedbuf[0]));
	RMDBGMIDDLE(5, RMDebug::module_indexif, "DBRCIndexDS", "domain " << myDomain << " constructed from " << InlineMinterval(dimension, &(lowerboundsbuf[0]), &(upperboundsbuf[0]), &(lowerfixedbuf[0]), &(upperfixedbuf[0])));

	free(upperboundsbuf);
	upperboundsbuf = NULL;
	free(lowerboundsbuf);
	lowerboundsbuf = NULL;
	free(upperfixedbuf);
	upperfixedbuf = NULL;
	free(lowerfixedbuf);
	lowerfixedbuf = NULL;
	
#ifdef RMANBENCHMARK
	DBObject::readTimer.pause();
#endif

	// (5) --- dbobject read
	DBObject::readFromDb();

	LEAVE( "DBRCIndexDS::readFromDb, myOId=" << myOId );
	RMDBGEXIT(5, RMDebug::module_indexif, "DBRCIndexDS", "readFromDb() " << myOId);
}

void
DBRCIndexDS::deleteFromDb() throw (r_Error)
{
	RMDBGENTER(8, RMDebug::module_indexif, "DBRCIndexDS", "deleteFromDb() " << myOId);
	ENTER( "DBRCIndexDS::deleteFromDb" );

#ifdef NOTYET   // should be in future
/*
	EXEC SQL BEGIN DECLARE SECTION;
*/
#endif // NOTYET
		double	id3;
		Oid	blobOid;
		char pgQuery[SQL_QUERY_BUFFER_SIZE];		// prelim
		PGresult *pgResult = NULL;	// prelim
#ifdef NOTYET   // should be in future
/*
	EXEC SQL END DECLARE SECTION;
*/
#endif // NOTYET

	// (1) --- set variables
	id3 = myOId;

	// (2) --- fetch blob oid
#ifdef NOTYET   // should be in future
/*
	TALK( "EXEC SQL SELECT DynData FROM RAS_RCINDEXDYN WHERE Id = " << id3 );
	EXEC SQL SELECT DynData FROM RAS_RCINDEXDYN
		WHERE Id = :id3;
	if (check("DBRCIndexDS::deleteFromDb() RAS_RCINDEX") != 0)
		generateException();
*/
#endif // NOTYET
	// alternative solution for now:
	(void) snprintf( pgQuery, (size_t) sizeof(pgQuery), "SELECT DynData FROM RAS_RCINDEXDYN WHERE Id = %f", id3 );
	TALK( pgQuery );
	pgResult = PQexec( pgConn, pgQuery );
	if (PQresultStatus(pgResult) != PGRES_TUPLES_OK)
	{
		LEAVE( "DBRCIndexDS::deleteFromDb() libpq 'select RAS_RCINDEXDYN' error: " << PQerrorMessage(pgConn) );
		PQclear( pgResult );
		generateException();
	}
	blobOid = atoi( PQgetvalue( pgResult, 0, 0 ) );		// extract value from result
	PQclear( pgResult );

	// (3) --- delete blob
	int loResult = lo_unlink( pgConn, blobOid );
	if (loResult < 0)					// no disaster if we can't so no exception
	{
		TALK( "DBRCIndexDS::deleteFromDb() warning: libpq 'unlink blob' error: " << PQerrorMessage(pgConn) );
	}

	// (3) --- delete tuple
#ifdef NOTYET   // should be in future
/*
	TALK( "EXEC SQL DELETE FROM RAS_RCINDEXDYN WHERE Id = " << id3 );
	EXEC SQL DELETE FROM RAS_RCINDEXDYN
		WHERE Id = :id3;
	if (SQLCODE != SQLOK)
	{
		check("DBRCIndexDS::deleteFromDb() delete from RAS_RCINDEX");
		LEAVE("DBRCIndexDS::deleteFromDb() 'delete from RAS_RCINDEX' error: " << SQLCODE );
		generateException();
	}
*/
#endif // NOTYET
	// alternative solution for now:
	(void) snprintf( pgQuery, (size_t) sizeof(pgQuery), "DELETE FROM RAS_RCINDEXDYN WHERE Id = %f", id3 );
	TALK( pgQuery );
	pgResult = PQexec( pgConn, pgQuery );
	if (PQresultStatus(pgResult) != PGRES_COMMAND_OK)
	{
		LEAVE( "DBRCIndexDS::deleteFromDb() libpq 'select RAS_RCINDEXDYN' error: " << PQerrorMessage(pgConn) );
		PQclear( pgResult );
		generateException();
	}

	// (4) --- dbobject delete
	DBObject::deleteFromDb();

	LEAVE( "DBRCIndexDS::deleteFromDb" );
	RMDBGEXIT(8, RMDebug::module_indexif, "DBRCIndexDS", "deleteFromDb() " << myOId);
}