Array Type Fields

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Raptor

    Array Type Fields

    Hi,

    I'm quite new to MySQL and quite impressed by its feature set. I've
    also been looking at Interbase and it has a feature that allows a
    multidimensiona l array to be stored in a single field. Does MySQL also
    have this feature? I was thinking about using MySQLs GIS data types but
    it only supports a two dimensional point, where as I need a three
    dimensional point to be stored. Each point represents a radar point. If
    anybody can suggest a different approach, I'm all ears.

    Steve
  • Bill Karwin

    #2
    Re: Array Type Fields

    Raptor wrote:[color=blue]
    > Hi,
    >
    > I'm quite new to MySQL and quite impressed by its feature set. I've
    > also been looking at Interbase and it has a feature that allows a
    > multidimensiona l array to be stored in a single field.[/color]

    InterBase (and the open-source version, Firebird
    http://firebird.sourceforge.net/) provides an N-dimensional array type
    as a proprietary extension to SQL. This feature is not generally
    available in other RDBMS's. It's also not generally supported by
    middleware products (ODBC, JDBC, DBI, etc.) because it doesn't map to a
    standard SQL datatype.
    [color=blue]
    > Does MySQL also have this feature?[/color]

    No, MySQL does not provide an array datatype.
    [color=blue]
    > I need a three
    > dimensional point to be stored. Each point represents a radar point. If
    > anybody can suggest a different approach, I'm all ears.[/color]

    You could store array data as a binary BLOB datatype, and write code in
    your application to encode/decode an array to/from a BLOB.

    Anothe solution would be to represent an array in a dependent table,
    where each row is one radar point, and there are five columns: three
    for the coordinates, one to reference the primary key of the master
    table, and one more for some kind of ordering (what you would use the
    array index for). You'd have to do a join between your master table and
    your "radar points" table.

    Regards,
    Bill K.

    Comment

    Working...