Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

"HERE" displays in output

by avilner (Initiate)
on Jun 18, 2015 at 03:07 UTC ( [id://1130927]=perlquestion: print w/replies, xml ) Need Help??

avilner has asked for the wisdom of the Perl Monks concerning the following question:

I am using perl to insert a record into SQL Server's table (via ODBC). My SQL statement is quite simple:
INSERT INTO raw ( CHROM ,POS ,ID ,REF ,ALT ,QUAL ,FILTER ,INFO ,FORMAT ) values (?, ?, ?, ?, ?, ?, ?, ?, ?);
and so are the values - nothing special. all varchars (doing a POC). Values are in an array, matching to the number of arguments insert expects. When I run this:
my $sth = $dbh->prepare($sql); $sth->execute( @values );
I get
HERE
as output. Since I am running in a command window and I need to insert millions of rows, HERE as the output is quite annoying. It started happening - for now reason (that I can think of), and it seems that the execute statement is what is triggering it. SQL table has no triggers or anything of that sort, and a simple insert via SQL Server Management studio results in no output (as expecte). Any ideas would be much appreciated!!!

Replies are listed 'Best First'.
Re: "HERE" displays in output
by GotToBTru (Prior) on Jun 18, 2015 at 03:52 UTC

    Are the inserts happening? If not, then you are probably only seeing part of an error message. Do you have the RaiseError flag set in your connection? Do you inspect $@ or $DBI::errstr?

    If this is not an error, you could redirect STDOUT to suppress the messages.

    Dum Spiro Spero
      The inserts are going into the database, so there is no issue there. Definitely not a DB message. Establish connection:
      my $dbh = DBI->connect( "dbi:ODBC:AV_Lenovo", "", "",{RaiseError => 1, + PrintError => 1, AutoCommit => 0} ) or die "Unable to connect: " . $DBI::errstr . "\n";
      ... do stuff Do insert:
      my $sql = join ('', "INSERT INTO raw ( CHROM ,POS ,ID ,REF ,ALT ,QUAL ,FILTER ,INFO ,FORMAT ) values (?, ?, ?, ?, ?, ?, ?, ?, ?);", "\n" ); eval { my $sth = $dbh->prepare($sql); $sth->execute( @values ); };
      If I output the @values, they look like this:
      1 10235 rs540431307 T TA 100 PASS AC=6 G
      ....so nothing unusual about them. And, as I mentioned, running the insert directly against SQL Server produces no messages.
Re: "HERE" displays in output
by kennethk (Abbot) on Jun 18, 2015 at 17:22 UTC
    HERE sounds an awful lot like a debug statement. Have you tried literally grepping your scripts and Perl local libraries for the word?

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

      HEREsounds an awful lot like a debug statement.

      That was my thought as well.

      On that note, it is possible (regardless of how unlikely) that perhaps you are executing an unexpected version of a module.

      I find with home-spun modules in particular, different versions of Perl honor local directory vs. PERL5LIBreferences in different ways. I've run into the situation where I'd make a change to a module whilst testing/refactoring it, and at some point I'd have a copy in the PERL5LIBas well as the local directory, and Perl was loading the version I wasn't expecting. Really messes with your head until you figure it out.

      If a copy of one of your modules is displaying HEREas part of a previous debugging/tracing effort, it's possible Perl is loading that version instead of the one you're examining.

      It's an outside chance, but one I've personally encountered (more than once, I embarrassingly admit). Just thought I'd throw that out there, in case.

Re: "HERE" displays in output
by Anonymous Monk on Jun 18, 2015 at 03:41 UTC

    1. Show us your code

    2. 'HERE' may be part of an SQL error message

Re: "HERE" displays in output
by sn1987a (Deacon) on Jun 18, 2015 at 17:30 UTC
    You may also want to verify that the "HERE" is actually coming from the execute, by printing a marker before and after:
    eval { print "Before prepare\n"; my $sth = $dbh->prepare($sql); print "Before execute\n"; $sth->execute( @values ); print "After execute\n"; };

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1130927]
Approved by GotToBTru
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-20 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found