Hi Monks!

I'm using DBI module.
I want to get the SQL statements prepared into a file. I hope someone can give me a solution.
#!/usr/bin/perl -w use strict; use DBI; ................. ................. insert(...........); sub insert{ my ($refNo, $price, $area, $Loc, $CategoryID, $PropertyName) = @_; my $userID = 0, my $cityID = 0; my $duration = 7; my $status = 1; my $title = "NA"; my $userIP = "NA"; print $userID."\t".$title."\t".$CategoryID."\t".$PropertyName."\t" +.$Loc."\t".$cityID."\t".$area."\t".$area."\t".$price."\t".$duration." +\t".$userIP."\t".$status."\n"; my $dbh = DBI->connect('DBI:ODBC:OptionsDB', 'sa', '') or die "Cou +ldn't connect to database: " . DBI->errstr; my $sth = $dbh->prepare('INSERT INTO optionsDB..nCopm_Content (use +rID, title, categoryID, propertyName, city, cityID, perchs, totalPerc +hs, userTotalPrice, duration, dateCreated, userIP, status) values (?, + ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, getdate())') or die "Couldn't prepa +re statement: " . $dbh->errstr; #DBI->trace("ALL|7", 'foo.txt'); #trace on $sth->execute ($userID, $title, $CategoryID, $PropertyName, $Loc, +$cityID, $area, $area, $price, $duration, $userIP, $status) or die "C +ouldn't execute statement: " . $sth->errstr; #Adump($sth); $sth->finish; DBI->trace(0); #trace off }

In reply to How to view SQL statements by Kanishka

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.