looking for a db abstraction/substitute that actually works

i am looking for a form of data storage that will answer a few requirements. i realize these requirements are non-standard, and for now i'm using activerecord and ORM solutions like everyone else, but this is my "holy grail" - if you know of anything like this, i would be eternally grateful:

  1. pure PHP
  2. multiple repositories, preferably file based for portability, where i can instantiate by telling it "use repository [X]" - i don't want to pre-create repository [X], if i reference it, it exists.
  3. zero database configuration - i don't want to create tables or export SQL dumps, if it's referenced in my code, it needs to be in the database, auto-created without any fuss, my code is my schema
  4. hierarchical, not relational, ideal structure would be just a freeform, schema-less XML, but since XML performs horribly with large trees, it can't simply be an XML file.

i have experimented with flat XML storage (with xpath and xquery) but it gags on a mid-sized repository, and cripples the application.

i have also experimented with key=>value pairs dropped into a SQLite database with a single generic table, but that gags even faster, and re-forming even the simplest record from key=>value pairs is a performance decimator.

finally, i experimented with lucene as implemented in the zend framework, which was pretty close to ideal, apart from the no-update part.

any ideas, anyone?

Answers


I've been having great fun with RedBean, it's not quite designed for flatfiles, but runs on PDO, so it should be relatively easy to write a sqlite module for it. Not sure if it will work for your needs, but definitely worth taking a look at.


Here are some links you may find useful:

Also, have you considered using Berkeley DB?

Some of the DB extensions listed in the PHP Manual are intended to be used on flat-file like databases.


From your description it seems like PHP arrays should work perfectly:

  • pure PHP
  • multiple arrays, file or memory based
  • your code is your schema
  • hierarchical

You could use serialize() or var_export() functions to enable file storage.


Need Your Help

Is AnkhSVN a good alternative to Visual SourceSafe?

visual-studio version-control

We've had it with Microsoft Visual SourceSafe 6.0d and want to move to SubVersion. Our IDE is Visual Studio 2005, but we plan to ugprade to 2008 soon. We are considering to install VisualSVN serv...

get-task-allowed remains true when developer signed binary is resigned as distribution

ios xcode code-signing provisioning-profile entitlements

I want a flow where my project is set up to produce an application signed with the development mobile provisioning profile, that can be resigned for AdHoc or AppStore distribution later on using Xc...