Suppose I have a collection of C++ objects in memory and would like to query them using an SQL statement. I’m willing to implement some type of interface to expose the objects’ properties like columns of a database row. Is there a library available to accomplish this?
In essence, I’m trying to accomplish something like LINQ without using the .NET platform.
Suppose I have a collection of C++ objects in memory and would like to
Share
C++ objects are not the same thing as SQL tables.
If you want to use SQL syntax to query the objects, you will first need to map/persist them into a table structure (ORM, object-relational-mapping). There are a number of fine ORM solutions out there besides Linq.
Once you have your objects represented in SQL tables, you should look to the SQL engine to do the heavy lifting. Most SQL platforms can be configured to keep a table mostly or always in memory.
As an alternative, you might consider a system specifically designed to cache objects. On Linux, memcached is a leading choice.