|
|
sybperl-l Archive
Up Prev Next
From: John_Erjavec at cargill dot com
Subject: confused with error while using ct_sql
Date: Nov 9 1998 11:11PM
All-
I am building an app that is going to ensure that our DSI threads are
down for as little time as possible. (OK, I am rewriting an app...)
I am trying to take example code from the docs, and modify it, since
I am new to writing sybperl apps. The following is the main chunk of
code that is causing the error:
=================CODE CHUNK======================
$X = Sybase::CTlib->ct_connect($uid, $pwd, $srv, $app);
@rows = $X->ct_sql("admin who", undef, 1) || die "execute failed!";
foreach $row_ref (@rows) {
if (($$row_ref{'Name'} eq "DSI") &&
($$row_ref{'Info'} =~ /.+\..+/)) {
print "Name: ", $$row_ref{'Name'}, "\n";
print "Info: ", $$row_ref{'Info'}, "\n";
}
}
=================CODE CHUNK======================
It is giving me the following error (under -w and use diagnostics):
=================ERROR===========================
Argument "DSI EXEC " isn't numeric in helem at ./who_test line 18
(#1)
(W) The indicated string was fed as an argument to an operator
that
expected a numeric value instead. If you're fortunate the
message
will identify which operator was so unfortunate.
Bad index while coercing array into hash at ./who_test line 18 (#2)
(F) The index looked up in the hash found as the 0'th element of
a
pseudo-hash is not legal. Index values must be at 1 or greater.
See perlref.
Uncaught exception from user code:
Bad index while coercing array into hash at ./who_test line
18.
=================ERROR===========================
Now, I'm not sure where the problem is, since I am not doing any
numeric tests, and I know that the keys 'Name' and 'Info' do exist
since I checked under perl -d. Anyone have an idea what I am doing
wrong here? Also, if you have a better way of doing what I am trying
to do, I would appreciate it. Right now, I am spawning an isql
process, feeding it the SQL, and parsing the output. The parsing is
done with regular expressions, and they can get pretty nasty for some
people. I am specifically checking to see if any of the DSI threads
are down or suspended, and then I will take the appropriate action,
depending. (The code above does not check for 'Down' or 'Suspended',
but this is just a first pass to make sure that this part is working,
which it is not. :( )
Anyway, any help is appreciated.
-JEV
John Erjavec V
Sybase DBA
Cargill, Inc.
john_erjavec@cargill.com
|