Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Embedded SQL in WF/Perl Code hangs up.
Raj_iw
Hi,
I am passing $dcrPath to the execute function, should that work?? thanks
my $qry = "SELECT FILENAME from CMS_TEAMSITE_TEST where FILENAME= ?";
my $dbh = TWC::Utils::dbConnect(TWC::Utils::getDBConnectionInfo());
my $sth = $dbh->prepare($qry);
my $rv = $sth->execute($dcrPath);
my $row = $sth->fetchrow_hashref)
$filen = $row->{'FILENAME'};
Find more posts tagged with
Comments
reddyl
try to executing the code from perl script to debug.
kaalraa
Try
$sth->bind_param(1,$dcrPath);
after prepare method and then
$sth->execute().
- AKs.... The Shadow
jsha
Hi,
I have been trying various things, did you mean run perl dugger? thanks
Raj_iw
Hi,
I have been trying various things, did you mean run perl dugger? thanks
jbonifaci
What line is it "hanging" on? Add error handling to each of your database calls and see what's going on. How are you executing your script? Make sure you are executing it from the command line so you can see any errors that might be output. If you can pinpoint the line in your code that you are having problems with, it will make it easier for us to help you. Or maybe, if you pinpoint the line number, you might even be able to figure it out yourself.
~Jeff
Example data.zip
kaalraa
What i am trying to say is that execute method does not accept the parameter...
Before executing the query just bind your parameter with the query and then execute
- AKs.... The Shadow
jbonifaci
Actually, you can either use bind_param or pass values in your execute() call.
~Jeff
kaalraa
But ...as far as i have worked most of the times, passing parameters through execute method does not associate the parameter to the query. Thats only a debugging suggestion.... if the code would work that ways.
- AKs.... The Shadow
jbonifaci
Passing parameters in the execute works the same as binding the parameter. Doing:
my $sth = $dbh->prepare("
SELECT *
FROM TABLE_NAME
WHERE COLUMN_ONE = ?
AND COLUMN_TWO = ?
");
$sth->execute('ColumnOneValue', 'ColumnTwoValue');
Will yield the same results as:
my $sth = $dbh->prepare("
SELECT *
FROM TABLE_NAME
WHERE COLUMN_ONE = ?
AND COLUMN_TWO = ?
");
$sth->bind_param(1, 'ColumnOneValue');
$sth->bind_param(2, 'ColumnTwoValue');
$sth->execute();
~Jeff
Raj_iw
Hi,
I am trying to debug with $DB::single=2; option in my peal code, but this pearl code is executed in a custom pearl module. When I try to to add -d option, the
pearl module does not like it, gives me an error. Any ideas? thanks
kaalraa
Thanks Jeff,
Anyways next time ... i do any task related, i will definitely try out this. I hope it works for me or else i have to look out for you then. LOL.
- AKs.... The Shadow
Raj_iw
Hi,
Some progress,
But this time it does not hang up, gives me following error,
-----------------
An error was detected during the execution of this task:
Can't locate object method "connect" via package "DBI" (perhaps you forgot to load "DBI"?) at
/WebApps/Internal/Interwoven/TeamSite/iw-perl/site/lib/TWC/Utils.pm line 259.
------------------
Any ideas??
thanks
jbonifaci
Did you load DBI...? Meaning do you have 'use DBI' at the top of your perl script?
Raj_iw
Thanks!!!! that worked!!!
Now just related question, Can I capture count(*) from SELECT statement as follows:
my $qry = "SELECT count(*) from TABLE_NAME where FILENAME= ?";
;
;
my $rv = $sth->execute($dcrPath);
my $row = $sth->fetchrow_hashref;
my $filen = $row->{'count(*)'};
kaalraa
Use:
my $qry = "SELECT count(*) AS mynumrecords from TABLE_NAME where FILENAME= ?";
;
;
;
my $rv = $sth->execute($dcrPath);
my $row = $sth->fetchrow_hashref;
my $filen = $row->{'mynumrecords'};
- AKs.... The Shadow
Raj_iw
Thanks
Edited by Raj_iw on 09/14/05 02:32 PM (server time).
kaalraa
Hello,
I dont think so... that this query should be under TeamSite Workflow head. Better ask these types in Perl Forums.
- AKs.... The Shadow