Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Rather than answer the question directly, I'd like to ask some questions about the question.

Display of "all the content of the database" "no matter how deep it goes"? If you want a generic script that recurses through foreign keys to display data, then consider 2 possibilities:

  1. Your database has a large number of tables with a large number of associations. You will potentially be writing out a massive stream of data. Why would you want to have such a massive file? Either for archiving or for a human to use.
    • Is it for a human to look at? How many trees would you sacrifice to print out a sizable chunk of a 5 gig database? How would a human find something in the file? Wouldn't it be better just figuring out what the human wants to know and writing some nice queries for them?
    • Is it for archiving? Then why not just dump the database (e.g., via mysqldump)?
  2. Your database is small with a small number of tables. In this case, why not just write a one-off script? You can change it later if you need to rerun it after a change to the schema is made. Trying to conceive of the general case with a recursive search through the data dictionary just seems like it will take alot of time. And recursive code is never the most readable if someone else needs to work with it later. There is a time and place for quick one-off hacks, and this may be one of them.

Although I don't know exactly what it is you are trying to do, my impression is that reanalyzing your initial approach may be fruitful.

Hope this helps :-)


In reply to Re: How to display all the content of the database? by Starky
in thread How to display all the content of the database? by Alex the Serb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-03-29 09:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found