Title: RE: perl and DB connectivities


you could try this little routine,
After opening the connection and making the query:-

while(($rc = $X->ct_results($restype)) == CS_SUCCEED) {
        next if ($restype == CS_CMD_DONE || $restype == CS_CMD_FAIL || $restype == CS_CMD_SUCCEED);
        @names = $X->ct_col_names();
       
        while(@dat = $X->ct_fetch) {
                #$no ++;
       
                if (%linehash) {undef(%linehash)};      #Clear out the hash ready for new data - if the hash exisits!

                $i=0;
                foreach $nm (@names) {                  #Populate a hash so that names of columns in DB can be used.
                       
                        $field{@names[$i]} = @dat[$i];
                        $i++;
                       
                }
}
}

.-----Original Message-----
.From: loan tran [mailto:[EMAIL PROTECTED]]
.Sent: 23 September 2002 16:12
.To: [EMAIL PROTECTED]
.Subject: perl and DB connectivities
.
.
.Howdy,
.
.Does someone know if there is a function in sybperl
.(use Sybase::DBlib) which does exactly the same thing
.of: $data = "$sth->fetchrow_hashref" (use DBI).
.
.In order words,
.when using DBI, i can extract data from Sybase using
.this
.$sql = qq(select name,dbid from sysdatabases);
.while(my $data = "$sth->fetchrow_hashref){
.   print "DBName: $data{name}\n
.          DBId:   $data{dbid}";
.}
.
.My question is:
.Is there $sth->fetchrow_hashref or something similar
.in sybperl (use Sybase::DBlib).
.
.Thanks.
.Loan
.
.__________________________________________________
.Do you Yahoo!?
.New DSL Internet Access from SBC & Yahoo!
.http://sbc.yahoo.com
.

This message has been scanned for Viruses by Trend Interscan - Indalo Technologies 
www.indalo.co.uk

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

Reply via email to