Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6128143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:35:36+00:00 2026-05-23T16:35:36+00:00

In our current project, we need some high level DBI for different databases. It

  • 0

In our current project, we need some high level DBI for different databases. It should provide the following features:

  • in memory cache – the DBI should be able to cache all reads, and update the cache on writing calls (the application we are coding on is heavy threaded, and needs fast access to the current data all the time). The memory cache will be based on boost::multi_index
  • automatic sql building – We don’t want to parse a sql statement to lookup in the memory cache

As we need to provide functions for: defining a table layout, do selects, do inserts, do updates, joins, …, the interface will get very complex.

We need a good way to invoke the interface function.

There are many styles around, but we could not find any useful for our usage.

Here a few examples:

SOCI

sql << "select name, salary from persons where id = " << id, into(name), into(salary);

We don’t want some SQL statements, so we would have to define what and from a different way.

pqxx

Conn.prepare("select_salary",
    "select name, salary from persons where id = $1")
    ((string)"integer",prepare::treat_direct);

The heavy usage of the overloaded operator() is just ugly, but it could work for us too.

Any suggestions how to design the interface?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:35:37+00:00Added an answer on May 23, 2026 at 4:35 pm

    How about using object relational mapping? Here’s some code fragment ideas off the top of my head – I’ve only done this in Python, never in C++, and only for fairly simple databases. There’s a list of frameworks on Wikipedia that should avoid too much wheel-related R&D.

    class people: public dbi_table
    {
        // id column handled by dbi_table.
        name: string_column;
        salary: money_column;
    };
    
    class cost_center: public dbi_table
    {
        name: string_column;
        office: foreign_key<offices>;
    };
    
    class people_cost_center_link: public link_table
    {
        // Many-many relationships.
    };
    

    Then you can manipulate records as objects, all the relational stuff is handled by the framework. Querying is done by defining a query object and then getting an iterator to the results (see the ODB wikipedia page for a code example).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In our current project we are providing a PDF download that can be customized
In my current project we are testing our ASP.NET GUI using WatiN and Mbunit
On my current project, I came across our master DB script. Taking a closer
We're about to start a new project, and our client's current application is .NET
The situation: I need to convert our current development environment from Windows XP 32-bit to
I have been asked to provide information on available techniques for assessing our current,
This is specific to my current project. But maybe the answers will reveal some
I'm using selenium to run some functional tests on the UI for our current
We recently split our current work into two different VS solutions, one which contains
Our current automated build consists of 1 master box and 4 core-2-duo pizza boxed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.