Compiling WITH_SQL_DATABASE (dcmqrscp)

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
martinrame
Posts: 347
Joined: Mon, 2009-02-23, 19:57

Compiling WITH_SQL_DATABASE (dcmqrscp)

#1 Post by martinrame »

Hi, I'm trying to implement SQL database support...but I can't even start compiling.

I'm on Ubuntu Linux x86_64, and downloaded sources and did "make" to test, it works ok. Now, this is what I did to start implementing the class "DcmQueryRetrieveSQLDatabaseHandleFactory":

1) I'm on dcmtk-3.5.5_20100504/dcmqrdb/apps
2) In dcmqrscp.cc, I added the define "WITH_SQL_DATABASE", as shown in this block:

Code: Select all

#define WITH_SQL_DATABASE

#ifdef with_sql_database
#include "dcmtk/dcmqrdb/dcmqrdbq.h"
#else
#include "dcmtk/dcmqrdb/dcmqrdbi.h"
#endif
3) Created the file dcmtk-3.5.5_20100504/dcmqrdb/include/dcmtk/dcmqrdb/dcmqrdbq.h by copying and dcmqrdbi.h and replacing DcmQueryRetrieveIndexDatabaseHandle by DcmQueryRetrieveSqlDatabaseHandle, and DcmQueryRetrieveIndexDatabaseHandleFactory by DcmQueryRetrieveSqlDatabaseHandleFactory.

4) Now, in dcmtk-3.5.5_20100504/dcmqrdb/libsrc, I created the file dcmqrdbq.cc, that implements the new classes in a process similar to step 3 (replacing DcmQueryRetrieveIndex.... by DcmQueryRetrieveSql...).

When I try to do a "make", I receive this error:

Code: Select all

c++ -O  -D_REENTRANT -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L -Wall   -L../libsrc -L../../dcmnet/libsrc -L../../dcmdata/libsrc -L../../ofstd/libsrc -L../../oflog/libsrc -o dcmqrscp dcmqrscp.o -ldcmqrdb -ldcmnet -ldcmdata -lofstd -loflog -lz  -lm -lrt -lpthread -lnsl 
dcmqrscp.o: In function `main':
dcmqrscp.cc:(.text+0x3afa): undefined reference to `DcmQueryRetrieveSqlDatabaseHandleFactory::DcmQueryRetrieveSqlDatabaseHandleFactory(DcmQueryRetrieveConfig const*)'
dcmqrscp.cc:(.text+0x3e0a): undefined reference to `DcmQueryRetrieveSqlDatabaseHandleFactory::~DcmQueryRetrieveSqlDatabaseHandleFactory()'
dcmqrscp.cc:(.text+0x3e19): undefined reference to `DcmQueryRetrieveSqlDatabaseHandleFactory::~DcmQueryRetrieveSqlDatabaseHandleFactory()'
collect2: ld returned 1 exit status
make: *** [dcmqrscp] Error 1
Apparently, the compiler can't find the file dcmqrdbq.cc that implements DcmQueryRetrieveSqlDatabaseHandleFactory.

Do I have to change something in the makefiles?.

Leonardo.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

These error messages are coming from the linker and not from the compiler. Of course, you need to add the new source file (and resulting object file) to the dcmqrdb library. In other words: Yes, you need to modify the libsrc/Makefile(.in).

martinrame
Posts: 347
Joined: Mon, 2009-02-23, 19:57

#3 Post by martinrame »

Thanks!

serj42
Posts: 4
Joined: Sat, 2011-11-05, 19:51

#4 Post by serj42 »

good day
i'm trying to combine with postgreSql(or mysql) on ubuntu, but i dont know what should be content in dcmqrdbq.h and dcmqrdbq.cc. can you help me?
should i to create database in pgSQL or dcmtk automatically configurate for this?
Thank you

martinrame
Posts: 347
Joined: Mon, 2009-02-23, 19:57

#5 Post by martinrame »

Well, the content of dcmqrdbq.cc must be adapted by you. I've started with the idx file version from dcmtk and replaced the code to an PgSql based version, it took me half of last year, many, many hours of learning the hard way!.

Right now, I suggest you to start with your own app based on DcmSCP class. It's way easier than adapting dcmqrscp.

Regarding your 2nd question. The easiest/fastest way is to create the database with an SQL script, in Postgresql, but nobody will stop you if you want to implement the database creation by code.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest