Re: Are there any databases that can store multidiimensional boolean arrays?



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
.



Relevant Pages

  • Re: using BLOB objects and ...
    ... while saving the array object to the database which is ok but while ... convert it back to object of 4 dimention boolean array which will be ... will let you store your 4 dimensional boolean array in it. ... You may have to modify my suggestion ...
    (comp.lang.java.programmer)
  • Re: Are there any databases that can store multidiimensional boolean arrays?
    ... This person wants to store a four dimensional boolean array, ... I'd never noticed the BitSet class before in several years of coding Java ...
    (comp.lang.java.databases)
  • Re: using BLOB objects and ...
    ... - You could use Memo if you converted your boolean array into a text string. ... boolean array when you fetch it from the database. ... You might be able to put the whole array in an OLE Object, ...
    (comp.lang.java.programmer)
  • Re: This Formula does not work....
    ... You have to know the subtleties in how SUM works. ... boolean array. ... generates an array, you would have to use an array formula to get SUM ... >>> formula below but no joy. ...
    (microsoft.public.excel.misc)
  • Are there any databases that can store multidiimensional boolean arrays?
    ... person wants to store a four dimensional boolean array, ... like a String to store it? ...
    (comp.lang.java.databases)