Доступные версии документации

Приложение 2. Пример обработки типов данных в DBI-интерфейсе

#!/usr/bin/perl
require DBI;
import DBI;

$t->{'t'} = "t";

$drh = DBI->install_driver('Linter');

print "Version = $drh->{Version}";

$database='';
$username='SYSTEM';
$auth='MANAGER';
$dbh = DBI->connect($database, $username, $auth, \%attr, 'Linter');

if(defined $dbh){
 $dbh->do('drop table bigint_test;');
 $dbh->do('create table bigint_test(b boolean, i int, j int, bi bigint, ch varchar(15), ch1 char(20));');
 $dbh->do('insert into bigint_test values(true, 10, 10, 42949672950, \'ddd\',\'\');');
 $dbh->do('insert into bigint_test values(false, 20, 10, 429496729500, \'ddd\',\'\');');
 $dbh->do('insert into bigint_test values(true, 30, 10, -42949672950, \'ddd\',\'\');');
 $dbh->do('insert into bigint_test values(false, 40, 10, -429496729500, \'ddd\',\'\');');


$sth=$dbh->prepare('insert into bigint_test values(?,?,?,?,?,?);');
if(defined $sth){
# @param=(100, 100, "-42949672950", "fff, "ff");
 @param=(1, 100, 100, -42949672950000, "fff", "ff");
 $sth->execute(@param);
 $sth->execute(@param);
 $sth->execute(@param);
}

$sth->finish;
$sth=$dbh->prepare('select b,i,bi,j,ch,ch1 from bigint_test;');
$t = $sth->{TYPE};

print  "\n$t->[0], $t->[1], $t->[2], $t->[3], $t->[4], $t->[5]\n";

#die "\n";

$rv = $sth->execute();
while(1){
 @row=$sth->fetchrow_array;
 last unless defined $row[0];
 print "\n-> $row[0] $row[1] $row[2] $row[3] $row[4] $row[5]<-\n";
 print $row[1] /100, "\n";
};

}else{
 die("\nconnection error\n");
}

die "\n";
Заметили ошибку?
Выделите текст и нажмите Ctrl + Enter