Placeholder question
- From: Derf <i.gave.up.my.privacy@xxxxxxxxx>
- Date: 11 Jul 2007 02:02:12 GMT
I am running on a Microsoft platform, Activestate Perl 5.8.7, connecting
to a MS SQL database
I want to use a placeholder in this code:
#!/usr/bin/perl -w
use CGI;$cg=new CGI;
use DBI;
use DBI qw(:sql_types);
use DBD::ODBC;
print $cg->header;
$query = $cg->param("q");
$dbh = DBI->connect('dbi:ODBC:dbname','user','pass',{'LongTrun***' => +
0, LongReadLen => 1000000 });
my ($searchget,$getresults);
$searchget = qq{SearchAllTables $query};
$getresults = $dbh->prepare( $searchget );
#$getresults->bind_param(1,$query,SQL_VARCHAR);#{TYPE=>SQL_VARCHAR}
$getresults->execute();
while(my @showquery = $getresults->fetchrow_array()){
$showquery[0] = "N/A" unless defined $showquery[0];
$aa=$showquery[0];
print "<p>$aa</p>";
}
$getresults->finish();
$dbh->disconnect();
#end
where SearchAllTables is a stored procedure
so I want to use (for example):
$searchget = qq{SearchAllTables ?};
$getresults = $dbh->prepare( $searchget )
$getresults->execute( $query )
but the code won't run with the placeholder, it errors out. It runs fine
if I don't use the placeholder, but I lose all the benefits of the
placeholder. Am I missing something simple here, or do placeholders not
work with stored procedures?
Derf
i.gave.up.my.privacy@xxxxxxxxx
.
- Prev by Date: Re: Smart way to detect SELECT statements?
- Next by Date: Re: Re: float bug? perl 5.8, DBI and oracle 10.2.0
- Previous by thread: float bug? perl 5.8, DBI and oracle 10.2.0
- Next by thread: Placeholder question
- Index(es):