in reply to How to reconstruct a SQL query from an executed $sth

Do you mean "tables" in the "relational database entity" sense or "tables" in the "columnar data" sense? If it's the former, you should already have a copy of your schema. describe [table] will help you out in MySQL-land. If it's the latter, why not just issue a SELECT statement? That's why you have a database!

Replies are listed 'Best First'.
Re: Re: How to reconstruct a SQL query from an executed $sth
by schweini (Friar) on Dec 20, 2002 at 03:32 UTC
    errr...tables in the HTML-sense. i really gotta express myself better. i'll try it in staccato-style:
    i use perl to generate html-pages. these contain tables that are the result of (more or less) complex sql-queries which use lots of placeholders (simplest example: the result of a search-form, where the user's query is, of course, bound to a placeholder). i $sth->execute() the $sth, and pass it to a generic printTable() sub, which does all the (rather advanced, if i may say so) html-formatting. i'd like these tables to generate and offer a "print this table!" link. thus, i have to pass the sql-query that actually generates this table to the script in charge of printing. this wouldn't be taht much of a problem if mysql would support $sth->{'ParamValues'} (which returns the values bound to placeholders). but dbd::mysql (to my knowledge) doesn't support this (yet?). thus, i fear i'm quite screwed (to put it lightly). thus i'm looking for a way to re-construct the SQL that an executed statement handle...well...executed.
    geez. i really shouldn't have bought this weak coffee. :-)