Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   DB library question (http://www.velocityreviews.com/forums/t805654-db-library-question.html)

Emil Barton 11-07-2011 02:11 PM

DB library question
 
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.


Waldek M. 11-07-2011 05:52 PM

Re: DB library question
 
On Mon, 7 Nov 2011 14:11:44 +0000 (UTC), Emil Barton wrote:
> 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

Emil Barton 11-07-2011 06:20 PM

Re: DB library question
 
Thank you for this answer.

On Mon, 07 Nov 2011 18:52:38 +0100, Waldek M. wrote:

> 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

Ian Collins 11-07-2011 06:36 PM

Re: DB library question
 
On 11/ 8/11 03:11 AM, Emil Barton wrote:
> 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.

--
Ian Collins

Emil Barton 11-07-2011 07:05 PM

Re: DB library question
 
On Tue, 08 Nov 2011 07:36:22 +1300, Ian Collins wrote:

> 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...


Waldek M. 11-07-2011 09:16 PM

Re: DB library question
 
On Mon, 7 Nov 2011 18:20:35 +0000 (UTC), Emil Barton wrote:
>> It's a little off-topic for this group, but...

> 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

emilbarton 11-11-2011 10:55 AM

Re: DB library question
 

On Mon, 07 Nov 2011 22:16:44 +0100, Waldek M. wrote:
> 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

none 11-16-2011 05:17 PM

Re: DB library question
 
In article <j98ov0$p9i$2@wieslauf.sub.de>,
Emil Barton <emilbarton@whynot.com> wrote:
>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...ftware#C.2B.2B


Yannick




All times are GMT. The time now is 04:48 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


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