|
|
sybperl-l Archive
Up Prev Next
From: John_Erjavec at cargill dot com
Subject: Re: confused with error while using ct_sql
Date: Nov 10 1998 12:38PM
Tried that. It gives me the same structure as doing an 'x @rows' in
the perl debugger. Thanks for the info, though. I've never used
Data::Dumper before, and now I have something else in my mental
library of debugging techniques. *g*
Anyway, the structure looks like this:
===============Structure================
$VAR1 = [
[
{
'Spid' => ' 27',
'Name' => 'DSI EXEC ',
'State' => 'Awaiting Command ',
'Info' => '113(1) DS0_CENTRAL.ops '
},
.
.
.
===============Structure================
Anyway, there seems to be two errors going on here, and I am not sure
why either one is happening. The first is that it is saying that
'DSI EXEC ' isn't numeric, and it was expected to be so. I am not
doing any numeric compares, and I don't think that I would get that
error even if I was (since I got the error even before I turned on
'-w' and 'use diagnostics'). I am not sure where it is trying to be
numeric. The second is saying that my hash indexes are bad, and I
have not clue one about how or why that would happen. If no one has
an idea what is going wrong here, does anyone have an idea on a
better way to do this? (I'm open to other suggestions.) Thanks.
-JEV
Sybase DBA
Cargill, Inc.
john_erjavec@cargill.com
______________________________ Reply Separator _________________________________
Subject: Re: confused with error while using ct_sql
Author: mpeppler (mpeppler@mbay.net) at mtka-unix-mime
Date: 11/9/98 7:07 PM
I really don't know what the problem is here.
I suggest the following:
use Data::Dumper;
...
print Dumper(\@rows), "\n";
...
to see what the real structure of the @rows array is...
Michael
John_Erjavec@cargill.com writes:
> 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
>
>
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@mbay.net -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com
|