Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 22 lines (18 sloc) 0.507 kb
package db;
use Data::Dumper;
use strict;
use utf8;
# 这里,没有返回类目标, 而是返回它的一个属性句柄, 所以没有办法继承.
sub new
{
my ($type, $user, $pass, $dsn) = @_;
my $self = {};
$self->{dbh} = DBI->connect($dsn, $user, $pass, { RaiseError=>1 });
$self->{dbh}->do('SET NAMES "utf8"');
# mysql_query("SET NAMES 'UTF8'");
# mysql_query("SET CHARACTER SET UTF8");
# mysql_query("SET CHARACTER_SET_RESULTS='UTF8'");
bless $self, $type;
return $self->{dbh};
}
1;
Jump to Line
Something went wrong with that request. Please try again.