DB library question

Discussion in 'C++' started by Emil Barton, Nov 7, 2011.

  1. Emil Barton

    Emil Barton Guest

    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.
     
    Emil Barton, Nov 7, 2011
    #1
    1. Advertising

  2. Emil Barton

    Waldek M. Guest

    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
     
    Waldek M., Nov 7, 2011
    #2
    1. Advertising

  3. Emil Barton

    Emil Barton Guest

    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
     
    Emil Barton, Nov 7, 2011
    #3
  4. Emil Barton

    Ian Collins Guest

    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
     
    Ian Collins, Nov 7, 2011
    #4
  5. Emil Barton

    Emil Barton Guest

    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...
     
    Emil Barton, Nov 7, 2011
    #5
  6. Emil Barton

    Waldek M. Guest

    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
     
    Waldek M., Nov 7, 2011
    #6
  7. Emil Barton

    emilbarton Guest

    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
     
    emilbarton, Nov 11, 2011
    #7
  8. Emil Barton

    none Guest

    In article <j98ov0$p9i$>,
    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.


    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
     
    none, Nov 16, 2011
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mythran
    Replies:
    0
    Views:
    2,475
    Mythran
    Aug 24, 2004
  2. Alan Ferrandiz [MCT]
    Replies:
    0
    Views:
    466
    Alan Ferrandiz [MCT]
    Sep 11, 2004
  3. Sweep

    Library in library...

    Sweep, Dec 8, 2003, in forum: C++
    Replies:
    1
    Views:
    405
    Jack Klein
    Dec 9, 2003
  4. Replies:
    6
    Views:
    872
    red floyd
    May 10, 2005
  5. iceColdFire

    Static library Vs. Dynamic library

    iceColdFire, May 17, 2005, in forum: C++
    Replies:
    3
    Views:
    17,099
Loading...

Share This Page