瀏覽代碼

utf8 for mysql

master
Pascal Gloor 5 年之前
父節點
當前提交
cb04c4c7ee
共有 2 個文件被更改,包括 4 次插入2 次删除
  1. 2
    1
      bin/autodoc_process.pl
  2. 2
    1
      cgi/autodoc.fcgi

+ 2
- 1
bin/autodoc_process.pl 查看文件

@@ -3,6 +3,7 @@
use strict;
use JSON;
use DBI;
use utf8;
use GD::Simple;
use Data::Dumper;
use Data::UUID;
@@ -275,7 +276,7 @@ sub sqlconnect {
my($sql) = @_;

my $dsn = "DBI:mysql:database=$sql->{base};host=$sql->{host}";
my $dbh = DBI->connect($dsn, $sql->{user}, $sql->{pass}) || \\
my $dbh = DBI->connect($dsn, $sql->{user}, $sql->{pass}, { mysql_enable_utf8 => 1 }) || \
die "Failed to connect to database";

return $dbh;

+ 2
- 1
cgi/autodoc.fcgi 查看文件

@@ -4,6 +4,7 @@ use strict;
use FCGI;
use JSON;
use DBI;
use utf8;
use GD::Simple;
use Data::Dumper;
use Data::UUID;
@@ -510,7 +511,7 @@ sub sqlconnect {
my($sql) = @_;

my $dsn = "DBI:mysql:database=$sql->{base};host=$sql->{host}";
my $dbh = DBI->connect($dsn, $sql->{user}, $sql->{pass}) || \\
my $dbh = DBI->connect($dsn, $sql->{user}, $sql->{pass}, { mysql_enable_utf8 => 1 }) || \
fatal_api_error(500,"Failed to connect to database");

return $dbh;

Loading…
取消
儲存