perl DBI shellscript return DELETE rows to stdout

From: bodotonight (bbooten_at_t-online.de)
Date: 10/22/04

  • Next message: bodotonight: "perl DBI shellscript return DELETE rows to stdout/pipe"
    Date: 22 Oct 2004 05:57:47 -0700
    
    

    hello,

    is it possible that a DELETE statement which runs in a perl shell
    script
    with DBI integration doesn´t write the affected rows to stdout ?

    here is my perlscript which runs ok.
    but after the sql DELETE statement the affected row are written to
    stdout and the apache module stops the pipe and the authentication
    stops
    with error.

    thanks for your help
    bodo

    e-mail: bbooten@t-online.de

    #!/usr/bin/perl -X
    # --- otpwcheck.pl ---

    #

    # Einbinden der Module
    use DBI;
    use strict;

    # Festlegen der Konfigurationsvariablen
    my $httpuserid = $ARGV[0]; # Userkuerzel aus .htaccess abfrage
    erhalten
    my $httpuserpwtan = $ARGV[1]; # User gibt ein padnr * tan
    aus .htaccess abfrage erhalten
    my $userpadnr; # variablen fuer die splitergebnisse hier anlegen
    my $usertan;

    # $httpuserpwtan aufsplitten in $userpassword und $usertan
    trennzeichen ist *

      ($userpadnr, $usertan) = split(/\*/, $httpuserpwtan);
      
      # MySQL-Datenbank oeffnen mit
      my $db=DBI->connect('dbi:mysql:dbotpw;localhost','xxxuser','xxxxx');
      

      # check user from table
      my $query = $db->prepare("SELECT Nr FROM OTPWUser WHERE
    Name='$httpuserid'");
      $query->execute;
      my @ergebnis = $query->fetchrow_array;

      if ($ergebnis[0]) # Wenn der Benutzername gefunden wurde:
      {
        $query = $db->prepare("SELECT Nr FROM OTPWList WHERE
    Name=$ergebnis[0] AND Padnr=$userpadnr AND Pad='$usertan'");
        $query->execute;
        my @ergebnis2 = $query->fetchrow_array;
        if ($ergebnis2[0])
        {
          $db->do(qq {DELETE FROM OTPWList WHERE Nr='$ergebnis2[0]'},
    undef, '');

          # here the apache module stops communication after the delete
          # if i mark the DELETE everything is ok module accept Success
    with
          # userid but the data are not deleted
          #
          #
          #
          print "Success\n$httpuserid\n";
        }
        else
        {
          print "Authentication Error Falsche Padnr";
        }
      }
      else
      {
        print "Authentication Error kein Datensatz mit Pad in der Liste";
      }
      $query->finish;
      $db->disconnect;


  • Next message: bodotonight: "perl DBI shellscript return DELETE rows to stdout/pipe"