Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 26 Apr 1999 @ 18:41:05 GMT


     
  <Prev Next>  
<<First
<Prev
Next>
Last>>
 


Subj:   Thanks and TeraPerl
 
From:   Bob Maccione

Thanks for the replies on the remote bteq connectivity problem (and I did look in the bteq documentation but that's another story).

I got a couple of questions on TeraPerl and have sent the current source maintainer a message with permission to release it (I assume that it's in the public domain but should check).

TeraPerl allows a user to do all of the CLI and ESQLc stuff with perl instead, very nice API and so far in my limited testing seems to work fine. An example is:

     #!/bin/perl
     #
     # illustrates use of the routine cli_relinfo.
     # uses the title and row routines of the sqlformat package
     # to do simple column headings akin to BTEQ output.

     use Sqlformat;

     # connect to the database
     $sess = PCli::init("databasename", "username", "passwd", "");

     # get the version info
     ($rel, $ver) = PCli::relinfo($sess);

     # print it
     print "DBC is running Release: $rel,  Version:$ver\n\n";

     # run a query   NOTE: put your query here!!
     $n = PCli::do($sess, "SELECT something FROM somewhere WHERE foo = foo" );

     # check the results
     print "$PCli::errstr" if $PCli::errno;

     # get the row count from the reply
     print "Query returns $n rows.\n" if($n > 0);

     # get and print the column names
     print Sqlformat::sqlformat_title($sess);

     # fetch all of the data
     while(@v = PCli::fetch($sess))
     {
         print Sqlformat::sqlformat_row($sess, @v);
     }

     print "done\n";

     # disconnect from the database
     PCli::disconnect($sess) || warn "$PCli::errstr" if $PCli::errno;

The nice thing is that it's perl so it's interpreted and seems to be rather fast.

I will post more as I get it.


thanks for the help and have fun,

bobm



     
  <Prev Next>  
<<First
<Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023