DB library question

E

Emil Barton

Hello, I have a Perl program running on top of a Postgresql db that I'd
like to replace by a standalone application independant from both Perl
and Postgresql. Is there a C++ db library that offers as many query
possibilities as Postgresql? I think mainly of nested requests. I dont
need the query engine to be necessarily SQL compatible.

Thank you in advance for your answers.
 
W

Waldek M.

Hello, I have a Perl program running on top of a Postgresql db that I'd
like to replace by a standalone application independant from both Perl
and Postgresql. Is there a C++ db library that offers as many query
possibilities as Postgresql? I think mainly of nested requests. I dont
need the query engine to be necessarily SQL compatible.

It's a little off-topic for this group, but...

You might want to have a look at SOCI: http://soci.sourceforge.net/

It's a very nice library that can use particular DB drivers
as a backend, eg. PgSQL, MySql, SQLite3 etc.

I haven't used it so far, but after reviewing the docs, I'm considering
giving it a try next time I do something SQL-related.


Best regards,
Waldek
 
E

Emil Barton

Thank you for this answer.

It's a little off-topic for this group, but...

Please redirect me to the right group then.
You might want to have a look at SOCI: http://soci.sourceforge.net/

This is nice but "off topic" for my question I'm afraid. I must have been
unclear. What I want is to create a database in C++ that would not
have to rely on other backends, drivers, engines or whatever you call
them in SQL or not. A pure C++ database providing its own structure,
algorithms and access methods, you understand?

Thank you if you can tell me if this is feasible with some existing
libraries in C++ or if I have to pump code from an exsting (opensource)
database system like Postgresql and translate it from scratch.

Emil
 
I

Ian Collins

Hello, I have a Perl program running on top of a Postgresql db that I'd
like to replace by a standalone application independant from both Perl
and Postgresql. Is there a C++ db library that offers as many query
possibilities as Postgresql? I think mainly of nested requests. I dont
need the query engine to be necessarily SQL compatible.

Have a look at Berkeley DB. Or just stick with Postgresql.
 
E

Emil Barton

Have a look at Berkeley DB. Or just stick with Postgresql.

Berkely DB does not allow nested requests if I remember well. You will
understand my problem easily if I tell you that my program would not
require often changes, however Postgresql is changing its procedural
language syntax each now and then forcing me to rewrite. I don't always
remember well the tricky parts of my code between 2 updates in Postgresql,
which makes the whole process of following Postgresql updates a real
pain, but otherwise my program doesn't run unless I reinstall an ancient
Postgresql package (and this is not done out of the box either as you
might know). I don't even tell you about explaining this to other users..
So I finally had the desire to get free from other programs...
 
W

Waldek M.

Please redirect me to the right group then.

I'm not sure which one would be good for you; comp.databases perhaps?
This one is on C++ language itself, and the standard library.
This is nice but "off topic" for my question I'm afraid. I must have been
unclear. What I want is to create a database in C++ that would not
have to rely on other backends, drivers, engines or whatever you call
them in SQL or not. A pure C++ database providing its own structure,
algorithms and access methods, you understand?

Frankly, I do not. C++ language does not specify databases, so there's
no way to have a "pure C++ database".
You might want to use some serialization framworks, like eg. google
protobuf. You might want to use simple write()/read() calls
on your structures provided you can save their state somehow.
Or use SQlite, which is an engine that comes as one header file.
More C in syntax than C++, actually.

Does any of these fulfil your needs?

Best regards,
Waldek
 
E

emilbarton

Or use SQlite, which is an engine that comes as one
header file. More C in syntax than C++, actually.

Does any of these fulfil your needs?

Yes I think it should do what I need. Many thanks
and best regards!

Emil
 
N

none

Hello, I have a Perl program running on top of a Postgresql db that I'd
like to replace by a standalone application independant from both Perl
and Postgresql. Is there a C++ db library that offers as many query
possibilities as Postgresql? I think mainly of nested requests. I dont
need the query engine to be necessarily SQL compatible.

OT but anyway. Assuming that you don't really want to become
independent from Postgresql but rather mean access the Postgresql
database directly and natively from C++ without using Perl or
SQL. Then:

a) Is your database relatively simple with few tables and simple
relationships:

Use libpqxx http://pqxx.org/development/libpqxx/

Very C++ and easy to use. Will allow you to interface with the
database natively in C++.

b) Is your database complex with lots of different objects and complex
relationships between them:

Consider using a Object Relationship Mapping library (ORM). This
could save you a large amount of development time rather than manually
defining everything.

See:
http://en.wikipedia.org/wiki/List_of_object-relational_mapping_software#C.2B.2B


Yannick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top