#!/usr/bin/perl -w
use strict; #使用严格语法
use DBI;
#my 关键字为严格语法的 变量申明关键字
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime();
$year += 1900;
my $time = "$year-$mon-$mday $hour:00:00";
print "开始生成$time统计资料!\n";
#连接postgresql数据库
my $dbh = DBI->connect('dbi:Pg:dbname=smscgw;host=127.0.0.1;port=9055',
'postgres', '') or die $DBI::errstr;
my $sql = "select provision_count(\'$time\',interval \'1 hours\')";
#执行统计过程
#my $return = $dbh->do($sql);
print "$sql\n统计完毕!\n";
#查看以安装的数据库驱动
#my @available = DBI->available_drivers;
#print @available;
#执行有结果集sql
# my $sth = $dbh->prepare($sql);
#prepare($sql);
#$sth->execute; # 先取得所有的内容
#关闭连接
$dbh->disconnect;