Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: Re: How to display all the content of the database?

by herveus (Prior)
on Jan 09, 2003 at 12:43 UTC ( [id://225517]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: How to display all the content of the database?
in thread How to display all the content of the database?

Howdy!

We are making some progress here.

However, I have some concerns.

You say:

sector(s_id, d_id, name); department(d_id, dd_id, name); division(dd_id, ... , name);

That looks a bit backwards from a normalization point of view. It appears that the higher level entity contains a pointer to the lower level entity, which is exactly backward from how it ought to be.

Consider:

sector(s_id, name, ...) department(d_id, s_id, name, ...) division(dd_id, d_id, name, ...)

In this rough schema, a department has a sector ID. In your schema, either a sector has to have multiple columns for department IDs or there have to be duplicate sector entries if a sector has more than one department.

Now, to get back to your actual question, if your requirement is simply to be able to use DBI, then without prior knowledge of the set of tables, you cannot depend on being able to discover the relationships, since not all DBDs offer that kind of support (DBD::CSV, DBD::RAM, for instance).

If you must use DBI with any arbitrary DBD for the data store, you will have to know up front the set of tables to examine. You won't even be able to count on getting a list of tables in the "database".

yours,
Michael

Replies are listed 'Best First'.
Re: Re: Re: Re: How to display all the content of the database?
by Alex the Serb (Monk) on Jan 09, 2003 at 12:52 UTC
    Sorry, I switched in a hurry :)

    ... however, you got it. It could even be a database that contains products and their parts and services that goes for unknown depth level. But, no matter how deep it goes and what is to be displayed, the script have to display parent entity and all of the tuples of its child entity and then all tuples of child entity (which is parent in this turn) and all of tuples of its child enitities, etc.

    It has already been done, using PHP and MySQL, but I'm doing things in Perl.
      Howdy!

      So the database is already implemented in MySQL? It would have been helpful to mention that earlier. :)

      I don't know MySQL well enough to know how it does referential integrity; I'm a Sybase guy being turned into an Informix guy.

      How does the PHP code discover children? You should probably be able to use the same metadata it uses. It can't know any more than your Perl script can.

      yours,
      Michael

        Well, give me $500 and I'll buy it and then I'll tell you how the problem is solved :)

        PS: for that price you'll get full web system with admin area and lots of other stuff.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://225517]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-04-26 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found