YES.

changing return $row->{PWORD}; to $row->{"DECODE(PWORD,'blah')"}; fixed it :D

S.T.O.U.T. = Synthetic Technician Optimized for Ultimate Troublshooting
----- Original Message ----- 
From: "Dennis Stout" <[EMAIL PROTECTED]>
To: "Kristofer Hoch" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, July 02, 2003 10 37
Subject: Re: Getting the right value >:|


> That could have been entertaining.  Still gives me a blank variable tho =/
>
> I would be more than happy to post complete source code, but it's VERY
lengthy
> (I got 8 modules, each of about 300 lines of code or more...).
>
> Dennis
>
> ----- Original Message ----- 
> From: "Kristofer Hoch" <[EMAIL PROTECTED]>
> To: "Dennis Stout" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Wednesday, July 02, 2003 10 21
> Subject: Re: Getting the right value >:|
>
>
> > 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_warn $sql;
> >
> >         my $sth = $dbh->prepare($sql);
> > # Unless your 'self' is a dbi handle....
> > #        my $sth = $self->prepare($sql);
> >
> >         $sth->execute or die "execute failed: $DBI::errstr";
> > }
> > --- Dennis Stout <[EMAIL PROTECTED]> wrote:
> > > Hi.
> > >
> > > Whenever I try to get the value of a field in a row from a SQL
> > > database, I'm
> > > either passed a blank line or the name of the spot in memory in which
> > > the
> > > information I want resides (like HASHx('80fd23afcc') or something).
> > > Earlier
> > > in the code, the right use statements as well as $Sql =
> > > TTMSSQL->new;.
> > > TTMSSQL is a customized engine for generating SQL queries, if you
> > > need to
> > > see the whole thing I can make it available.
> > >
> > > emit_ and post_ routines are called via a RequestHandler when the
> > > user goes
> > > to certain URI's on the server...  The RequestHandler and Dispatch
> > > Table
> > > work just fine as I've thoroughly tested them..  This SQL is simply
> > > not
> > > working tho >:|
> > >
> > > Here are the routines.
> > >
> > > sub get_password {
> > >         my $state = shift;
> > >
> > >         my $sth = $Sql->select_decode('PWORD', 'techs',
> > > "TECH=\"$state->{q}->{login_user}\"
> > > ");
> > >         my $row = $sth->fetchrow_hashref;
> > >
> > >         return $row->{PWORD};
> > > }
> > >
> > > sub emit_login_form {
> > >         my $state = shift;
> > >         my %args = $state->{q};
> > >         $state->{template} = 'generic.tmpl';
> > >         $state->{title} = 'TTMS Login';
> > >
> > >         $args{body} = <<EOF;
> > > <DEFANGED_form method="post"
> action="http://ttms.stout.dyndns.org/login.cgi";>
> > > <table border-"0" cellpadding="0" cellspacing="0">
> > > <tr><td>Username</td><td><input type="text"
> > > name="login_user"></td></tr>
> > > <tr><td>Password</td><td><input type="password"
> > > name="login_pass"></td></tr>
> > > <tr><td colspan="2" align="center"><DEFANGED_input type="submit"
> > > value="submit"></td></tr>
> > > </table>
> > > </DEFANGED_form>
> > > EOF
> > >
> > >         return output_html($state, %args);
> > > }
> > >
> > > sub post_login_form {
> > >         my $state = shift;
> > >         my %args = $state->{q};
> > >         $state->{template} = 'generic.tmpl';
> > >         $state->{title} = 'TTMS Login';
> > >
> > >         my $checkpass = get_password($state);
> > >
> > > #       if ($checkpass eq $state->{q}{login_pass}) {
> > > #               $state->{login_user} = $state->{q}{login_user};
> > > #               $state->{login_pass} = $state->{q}{login_pass};
> > > #               $state->{auth_status} = "Logged in as
> > > $state->{login_user}";
> > > #               $state->{cookie_out} = set_auth_cookie($state);
> > >
> > > #               $args{body} = "Login Successful!";
> > > #       } else {
> > > #               $state->{cookie_out} = set_logout_cookie($state);
> > >
> > > #               $args{body} = "Login Unsuccessful.";
> > > #       }
> > >
> > >         $args{body} = "login_user:
> > > $state->{q}{login_user}<br>login_pass:
> > > $state->{q}{login
> > > _pass}<br>checkpass: $checkpass";
> > >         return output_html($state, %args);
> > > }
> > >
> > > 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_warn $sql;
> > >         my $sth = $self->prepare($sql);
> > >
> > >         $sth->execute                   or die "execute failed:
> > > $DBI::errstr";
> > >
> > >         $sth;
> > > }
> > >
> > > Thanks,
> > > Dennis
> > >
> > >
> > > -- 
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
> >
> > =====
> > -----BEGIN GEEK CODE BLOCK-----
> > Version: 3.12
> > GIT d s+:++ a C++ UL++ US+ P+++ L++
> > W+++ w PS PE t++ b+ G e r+++ z++++
> > ------END GEEK CODE BLOCK------
> >
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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

Reply via email to