File: testmulti.pl

package info (click to toggle)
libdbd-odbc-perl 1.37-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,272 kB
  • sloc: perl: 7,932; ansic: 5,991; makefile: 33; sql: 8
file content (28 lines) | stat: -rw-r--r-- 704 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use DBI;
# $Id: testmulti.pl 11680 2008-08-28 08:23:27Z mjevans $

#$ENV{'ODBCINI'}="/export/cmn/etc/odbc.ini" ;
my($connectString) = "dbi:ODBC:DSN=TESTDB;Database=xxxxxdata;uid=usrxxxxx;pwd=xxxxx" ;
# DBI->trace(9) ;
my($dbh)=DBI->connect() ;
if ( !defined($dbh) ) {
   die "Connection failed" ;
}
my($sqlStr) ;

$sqlStr = "select id,name from sysobjects where id=1; select * from sysobjects where id=1; select \@\@rowcount";


my($sth) = $dbh->prepare($sqlStr);
$sth->execute;
if ( $sth->errstr ){
   die $sth->errstr ;
}
my(@aRefResult) = qw() ;
my(@data) = qw() ;
my($cnt);
do {
   while ( @data = $sth->fetchrow ) {
       print join("|",@data), "\n" ;
   }
} while ( $sth->{odbc_more_results}  ) ;