Re: Are there any databases that can store multidiimensional boolean arrays?
- From: Robert Klemme <bob.news@xxxxxxx>
- Date: Tue, 04 Jul 2006 17:35:07 +0200
Rhino wrote:
I'm helping someone on another newsgroup but I need to know something. This person wants to store a four dimensional boolean array, i.e. boolean[][][][], in a column of a database. There are 53,000 entries in a single occurrence of this array and they wan to store over 200,000 instances of the array, one in each row of the table.
Ideally, that array could be stored as an Object of type boolean[][][][]: then the user wouldn't have to turn it into something else for storage and then convert it back when reading it. Are there any databases that can do that? Or would I inevitably have to convert this array into a simpler object like a String to store it? For example, it wouldn't be hard to convert this boolean array:
boolean[] myArray = {true, false, true};
to a String like this:
String myString = "TFT"; //T=true; F=false
Unlikely to work good with your 53,000 entries. Usually VARCHAR columns have a size restriction far below this margin.
I know that JDBC has setObject() and getObject() methods but I'm really not clear on how they are used, even after reading the API. It appears that I still have to identify the object as one of the standard java.sql.Type values and boolean[][][][] is NOT a standard java.sql.Type!
Can anyone shed some light on this for me?
If you don't need these booleans for querying (i.e. as selection criteria) the simplest solution is probably to serialize these arrays into a BLOB column. You could also convert them to a BitSet before insertion.
If you need to use boolean values from the array as select criteria it gets more complicated. One thing you *could* do is to have a table with
idx_1, idx_2, idx_2, bool, i.e. store the indexes in the table. But this will burn a lot of mem.
Just my 0.02EUR...
robert
.
- Follow-Ups:
- References:
- Prev by Date: Are there any databases that can store multidiimensional boolean arrays?
- Next by Date: Re: Are there any databases that can store multidiimensional boolean arrays?
- Previous by thread: Are there any databases that can store multidiimensional boolean arrays?
- Next by thread: Re: Are there any databases that can store multidiimensional boolean arrays?
- Index(es):
Relevant Pages
|
|