Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Template::Toolkit - How do i access alias-based results?

by Yaerox (Scribe)
on Jul 13, 2015 at 12:50 UTC ( #1134489=note: print w/replies, xml ) Need Help??


in reply to Re: Template::Toolkit - How do i access alias-based results?
in thread Template::Toolkit - How do i access alias-based results?

Using Perl - CGI I'd do it like this:
$hDB = _OracleConnect(); $hStatement = $hDB->prepare("MY SQL"); $hStatement->execute( $var1, $var2, $var3 ); while ( ( $ret1, $ret2, $ret3 ) = $hStatement->fetchrow_array ){ # do stuff } $hStatement->finish; $hDB->disconnect;
Or do you want me to data dump? If yes, in Template Toolkit, or just by using Perl CGI? Because I won't know how to dump this helpful in Template Toolkit.

Leaving the u prefix on the printings doesn't make a difference. I already tried this, just saying % user.name % but still empty.

Replies are listed 'Best First'.
Re^3: Template::Toolkit - How do i access alias-based results?
by Corion (Pope) on Jul 13, 2015 at 12:56 UTC

    Yes, printing a Dumper output of the data structure you create in # do stuff or even better, the data structure that you give to Template::Toolkit would help to find out what you need to do to access the elements of the data structure.

      # DB - Connect my $hDB = DBI->connect( "dbi:Oracle:dbname", "dbusername", "dbuserpass +wort", { AutoCommit => 0 } ); my $hStatement = $hDB->prepare("MY SQL HERE"); $hStatement->execute( ); while ( ( $var1, $var2, $var3) = $hStatement->fetchrow_array ){ push( @aRows, ( $var1, $var2, $var3 ) ); } $hStatement->finish; $hDB->disconnect; print Dumper( @aRows );
      output
      $VAR1 = '11000530'; $VAR2 = '8041094A'; $VAR3 = 'Eingelesen'; $VAR4 = +'09-JUL-15'; $VAR5 = '528';
      Imo this shouldn't be interesting at all. The question is, how to access resultset when using joings on TT ...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1134489]
help
Chatterbox?
[Corion]: Ooooh! SQLite 3.25.0 (Pending) might get Window Functions! That would be really, really great!
[Corion]: (we're at 3.24.0 , so maybe the feature appears this year even)

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2018-07-23 11:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (464 votes). Check out past polls.

    Notices?