Note that there are some explanatory texts on larger screens.

plurals
  1. POruby in-memory object database with unlimited instances
    primarykey
    data
    text
    <p>I'm trying to get a sort of object database in memory which can support an arbitrary number of instances/connections. Lets start with the library example:</p> <p>Lets say I have a <code>Library</code> class. I can create as many instances of this class as I want.<br> Each instance of <code>Library</code> has a collection of <code>Library::Book</code> objects (accessible as <code>library.books</code>). This collection of books is specific to that library instance.<br> I also have <code>Library::Magazine</code> which behaves the same.<br> And with this I can do things like <code>library.books['Nineteen Eighty Four'].author</code>, <code>library.magazines.each {...}</code>, <code>library.magazines.delete(magazine)</code>.</p> <p>Now up to this point it isn't hard. Any database model library can handle it. However I want to be able to clone the "library". Meaning I can take an instance of <code>Library</code>, and do <code>library.clone</code>, and get a brand new library which is an exact duplicate of the origin. But the new copy will have it's own collection of <code>Books</code> and <code>Magazines</code> (which was created from the origin).<br> This means it should create a duplicate database, and both databases can be accessed simultaneously.</p> <p>It's this arbitrary number of databases with simultaneous access that seems to be very difficult. Ideally I would like it to be a relational database with foreign key constraints (so I can do something like <code>library.categories['fiction'].books.each {...}</code> and have a foreign key on the book referencing the category it's in).</p> <p>I've been hacking away with <a href="http://sequel.jeremyevans.net/" rel="nofollow">Sequel</a> for a bit, and it comes close in that it allows multiple sqlite in-memory databases. But it's proving extremely difficult to get it to support an arbitrary number of them (it wants a constant class representing each table in each database).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload