Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Database access problem

by SamCG (Hermit)
on May 19, 2006 at 16:01 UTC ( [id://550525]=note: print w/replies, xml ) Need Help??


in reply to Database access problem

I'll give you the best explanation I can of the Perl part:
Assuming $dbh is a database handle and you're using DBI, it attempts to prepare a sql statement
if exists(select 1 from INFORMATION_SCHEMA +.tables where table_name = 'DSR_SMR_Result_storage_keep') begin DROP +TABLE DSR_SMR_Result_storage_keep end
and gives an error if it can't prepare it.

It does so by 1) setting the sql statement to a scalar variable, 2) declaring another scalar, and 3) using a previously prepared database handle to prepare the sql statement.

Of course, you don't actually need to know much Perl to know that; I'm sure anyone who worked in any language could tell you that. I'd suspect you yourself knew that already.

That's why people keep telling you you're not asking Perl questions. If my answer above was actually helpful, maybe you really are having Perl problems. If not, you should go to some other forum with this stuff. Believe it or not, generally Sql Server experts know more about T-SQL than Perl experts (not that I'm claiming particular expertise), and you'd get far better answers to your questions.



-----------------
s''limp';@p=split '!','n!h!p!';s,m,s,;$s=y;$c=slice @p1;so brutally;d;$n=reverse;$c=$s**$#p;print(''.$c^chop($n))while($c/=$#p)>=1;

Replies are listed 'Best First'.
Re^2: Database access problem
by ptum (Priest) on May 19, 2006 at 16:18 UTC

    Thanks for this gentle and insightful response. Posts like this are one of the things that set PerlMonks apart as a site where people (even lazy people) are patiently taught to fish rather than being given a quick meal. Not that responses like Where's my pony? aren't funny, but I suspect some readers don't understand the humor and chalk them up as monks being spitefully mean.

    As someone who has occasionally been unsure about whether a question had 'enough Perl' in it to justify a SoPW post, I appreciate your analysis.


    No good deed goes unpunished. -- (attributed to) Oscar Wilde

      I'm actually surprised. Aside from the complete lack of context, any explanation of what's expected, any error messages, or useful direction besides the Neanderthalic "Ugh code no work" I could see where this might actually be the first recent posting have a vague marginal amount of Perl relevance out of the gate which wasn't stealth edited in after people have already downvoted it into the bowels of Worst Nodes.

      Granted he's still a bozo who won't bother to learn from How (Not) To Ask A Question no matter how many people point him at it.

      And I still want my pony.

        "Ugh code no work"

        That is hilarious.
Re^2: Database access problem
by Fletch (Bishop) on May 19, 2006 at 16:40 UTC
    and gives an error if it can't prepare it.

    Actually it will give an error but not the one from DBI, since if the prepare fails the statement handle scalar will be undef and Perl will gripe about attempting to call a method on it.</pedant>

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found