Are there any free/open source databases which can properly store arrays?
I am looking for a free/open source database which can properly store (multi-dimensional) arrays.
Once the array is stored in the database, 开发者_如何学Cthe items in that array should be searchable within the database. This means, I don't want to serialize it.
It should be able to run under Linux (SuSe), and I want to use it with Python and PHP.
Check out MongoDB. It's a fast and feature-rich document database, capable of storing and searching arrays and objects ("documents"). It has client libraries for a lot of different languages, including PHP and Python.
There are some alternatives as well, for example CouchDB and Jackrabbit, but I haven't tested them myself.
Edit: I see now that you've tagged the question "sql". Neither of these databases is relational and does not implement SQL. They are, however, competent and worth checking out.
In standard SQL, you can do
CREATE TABLE MyArray (
RowIndex INTEGER,
ColIndex INTEGER,
Value /* whatever type the array elements have */,
UNIQUE (RowIndex, ColIndex)
);
Firebird has array support, but I don't know that you can retrieve specific array elements via Query. I think you have to retrieve the array as a field, then parse it using your other scripting language. I know Kinterbasdb for Python supports storing / retrieving them. We considered this briefly, but for our needs serialization of the data actually ended up making more sense.
PostgreSQL has built-in array data types. You can declare a column to store an array and your SELECT queries can access individual array elements.
精彩评论