I have another subroutine,

sub select_hashref
{
        my $self = shift;
        my $dbh  = $self->{dbh};
        my ($select, $from, $where, $other) = @_;

        my $sql="SELECT $select ";
        $sql.="FROM $from " if $from;
        $sql.="WHERE $where " if $where;
        $sql.="$other" if $other;

        # connect , or reuse $dbh, prepare and execute
        my $sth = $self->prepare($sql);
        my_warn $sql;

        $sth->execute                                   or die "execute
failed: $DBI::errst
r";

        my $hr = $sth->fetchrow_hashref();
        $sth->finish();

        $hr;
}

which returns to me EXACTLY what is in the SQL datbase (an encrypted
password).

I erased what I had a few moments ago, and replaced select_decode with

sub select_decode
{
        my $self = shift;
        my $dbh  = $self->{dbh};
        my ($select, $from, $where, $other) = @_;

        my $sql="SELECT DECODE($select,\'blah\') ";
        $sql.="FROM $from " if $from;
        $sql.="WHERE $where " if $where;
        $sql.="$other" if $other;

        # connect , or reuse $dbh, prepare and execute
        my $sth = $self->prepare($sql);
        my_warn $sql;

        $sth->execute                                   or die "execute
failed: $DBI::errst
r";

        my $hr = $sth->fetchrow_hashref();
        $sth->finish();

        $hr;
}

The only difference is the adding of DECODE() to the select string.

Note ->  A direct query of SELECT DECODE(PWORD,'blah') from techs where
TECH='stout'; works perfectly and returns my decrypted password.

I also tweaked the get_password routine:

sub get_password {
        my $state = shift;

        my $row = $Sql->select_decode('PWORD', 'techs',
"TECH=\"$state->{q}->{login_user}\"
");

        return $row->{PWORD};
}

Now, if I change select_decode in get_password to select_hashref, I get
returned to me the exact string from the SQL server, which is an encrypted
password.

As it is now, I get a blank return.

AHG.

Dennis


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to