Loading ...
Sorry, an error occurred while loading the content.

[PBML] Simple database

Expand Messages
  • Ravenhall, Stewart {PDMB~Welwyn}
    Hi. I have a really simple database (perhaps that s too grand a word) containing, in a single table, code , user and status . Each code can have many
    Message 1 of 2 , Dec 5, 2003
    View Source
    • 0 Attachment
      Hi.

      I have a really simple database (perhaps that's too grand a word)
      containing, in a single table, "code", "user" and "status". Each code
      can have many users, and each user can have many codes. The combination
      of code & user is the unique key.

      I was thinking of storing this as a hash of hashes but because I have
      only a hundred records or so and I don't know which of the key fields
      will be used in extraction criteria I've been told this would be rather
      inefficient. Is there some better way?

      Example:
      code=abc123, user=bob, status=all
      code=abc123, user=fred, status=all
      code=xyz987, user=bob, status=fail
      code=xyz987, user=ian, status=all

      select code from database where user='ian';
      select user from database where code='abc123';

      Thanks!
      Stew
    • Jenda Krynicky
      From: Ravenhall, Stewart {PDMB~Welwyn} ... Take a look at DBD::SQLite on http://search.cpan.org You may install it by PPM.
      Message 2 of 2 , Dec 5, 2003
      View Source
      • 0 Attachment
        From: "Ravenhall, Stewart {PDMB~Welwyn}" <STEWART.RAVENHALL@...>
        > I have a really simple database (perhaps that's too grand a word)
        > containing, in a single table, "code", "user" and "status". Each code
        > can have many users, and each user can have many codes. The
        > combination of code & user is the unique key.

        Take a look at DBD::SQLite on http://search.cpan.org

        You may install it by PPM.

        Jenda
        ===== Jenda@... === http://Jenda.Krynicky.cz =====
        When it comes to wine, women and song, wizards are allowed
        to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery
      Your message has been successfully submitted and would be delivered to recipients shortly.