Re: Are there any databases that can store multidiimensional boolean arrays?
- From: "Rhino" <no.offline.contact.please@xxxxxxxxxx>
- Date: Tue, 4 Jul 2006 11:59:13 -0400
"Robert Klemme" <bob.news@xxxxxxx> wrote in message
news:4gvg5bF1p9mdbU1@xxxxxxxxxxxxxxxxx
Rhino wrote:No problem. I'd just use a CLOB then.
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'd never noticed the BitSet class before in several years of coding JavaI 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.
but I just took a look at it in the API. Is there any particular reason why
it is better than just turning a boolean array into a String of T's and F's.
I assume it uses less space since bits are smaller than Strings but wouldn't
it get a bit cumbersome to have to have a Bitset within a Bitset within a
Bitset within a Bitset just to represent this array?
If you need to use boolean values from the array as select criteria itAs I said, I'm helping someone else and I don't know if they want to use
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.
these booleans as search criteria or not.
Just my 0.02EUR...Okay, thanks for your input!
--
Rhino
.
- Follow-Ups:
- Re: Are there any databases that can store multidiimensional boolean arrays?
- From: Jon Martin Solaas
- Re: Are there any databases that can store multidiimensional boolean arrays?
- From: Oliver Wong
- Re: Are there any databases that can store multidiimensional boolean arrays?
- From: Robert Klemme
- Re: Are there any databases that can store multidiimensional boolean arrays?
- References:
- Prev by Date: Re: 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: Re: 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
|