Relational databases and tied hashes?

Discussion in 'Perl Misc' started by Lee Goddard, Dec 15, 2004.

  1. Lee Goddard

    Lee Goddard Guest

    At 2004-12-14 08:26:01 PST, Sherm Pendley ()
    wrote:

    >If you're thinking this would take three separate SQL queries, you

    can
    >...join


    Thanks, that's true, but what I'm really looking for is a way to tie
    multiple, linked tables to a hash.

    And at 2004-12-14 08:50:03 PST, Matija Papec ()
    added:

    >Check for Tie::DBI, it does even table updating for you


    It does, but I can't find any info there on using it on tables related
    by UID. I've been look at the author's Tie::RDBM too, but that rather
    seems a misnoma - it doesn't seem to be so much a Relational DataBase
    Manager, as a way of freezing and thawing perl data to a database.

    I'm trying to use perl to dynamically create an RDB based upon an XSD
    file, and then to parse SCORM Manifest XML on the fly, using the XML's
    cross-referencing UIDs as related fields.

    Does anyone out there have any ideas of another module that might
    provide the underlying functionality? I don't much fancy writing a DB
    Tie this close to the holidays with so much 'flu' around ...

    Thanks
    Lee
    Lee Goddard, Dec 15, 2004
    #1
    1. Advertising

  2. Lee Goddard

    Alan Mead Guest

    Star date: Wed, 15 Dec 2004 01:59:54 -0800, Lee Goddard's log:

    > At 2004-12-14 08:26:01 PST, Sherm Pendley ()
    > wrote:
    >
    >>If you're thinking this would take three separate SQL queries, you

    > can
    >>...join

    >
    > Thanks, that's true, but what I'm really looking for is a way to tie
    > multiple, linked tables to a hash.
    >
    > And at 2004-12-14 08:50:03 PST, Matija Papec ()
    > added:
    >
    >>Check for Tie::DBI, it does even table updating for you

    >
    > It does, but I can't find any info there on using it on tables related
    > by UID. I've been look at the author's Tie::RDBM too, but that rather
    > seems a misnoma - it doesn't seem to be so much a Relational DataBase
    > Manager, as a way of freezing and thawing perl data to a database.
    >
    > I'm trying to use perl to dynamically create an RDB based upon an XSD
    > file, and then to parse SCORM Manifest XML on the fly, using the XML's
    > cross-referencing UIDs as related fields.
    >
    > Does anyone out there have any ideas of another module that might
    > provide the underlying functionality? I don't much fancy writing a DB
    > Tie this close to the holidays with so much 'flu' around ...


    Lee,

    I cannot figure out precisely what you are trying to do. It seems like
    this is really a reply where some key details were left off.

    But it seems as if you're asking which PDA is right for Enterprise
    Accounting... which wouldn't make sense. Similarly, hashes and RDB's
    are just different things for different purposes.

    My best guess about what you want is a special case of a set of SQL tables
    where there are foreign key constraints and you want to pretend like the
    tuples are in a single table. I think I can promise that no one has gone
    to the trouble of making a solution for this constrained special case when
    you can easily make the same functionality, plus much more, with standard
    SQL.

    One solution that's kind of like both is sqlite. If you haven't checked
    it out, there are Perl bindings at www.sqlite.org and it runs on Windows
    and Linux (among others).

    If you are having trouble with SQL or DBI then I'm sure there are people
    like myself here who can help.

    -Alan
    Alan Mead, Dec 15, 2004
    #2
    1. Advertising

  3. Lee Goddard

    Matija Papec Guest

    X-Ftn-To: Lee Goddard

    (Lee Goddard) wrote:
    >>Check for Tie::DBI, it does even table updating for you

    >
    >It does, but I can't find any info there on using it on tables related
    >by UID. I've been look at the author's Tie::RDBM too, but that rather
    >seems a misnoma - it doesn't seem to be so much a Relational DataBase
    >Manager, as a way of freezing and thawing perl data to a database.


    Didn't try the Tie::RDBM but with first one you can tie hash with sql table
    and retrieve $uid properties like,

    my $name = $item{$uid}{name};
    my $price = $item{$uid}{price};
    my $image = $item{$uid}{image};


    --
    Matija
    Matija Papec, Dec 17, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Frigot

    Xindice VS Relational Databases

    Eric Frigot, Dec 20, 2004, in forum: XML
    Replies:
    1
    Views:
    452
    Jim Kennedy
    Dec 21, 2004
  2. Tom

    tied multi dimensional hashes

    Tom, Sep 17, 2003, in forum: Perl Misc
    Replies:
    1
    Views:
    71
    Bob Walton
    Sep 18, 2003
  3. Lee Goddard

    Relational databases and tied hashes?

    Lee Goddard, Dec 14, 2004, in forum: Perl Misc
    Replies:
    2
    Views:
    95
    Matija Papec
    Dec 14, 2004
  4. Tim O'Donovan

    Hash of hashes, of hashes, of arrays of hashes

    Tim O'Donovan, Oct 27, 2005, in forum: Perl Misc
    Replies:
    5
    Views:
    209
  5. PerlFAQ Server
    Replies:
    0
    Views:
    92
    PerlFAQ Server
    Mar 27, 2011
Loading...

Share This Page