summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-29 03:00:44 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-29 03:00:44 +0000
commit02ece7f8642038fffd47d53e46a32efa14d636f5 (patch)
treed95ad45c8607b1aa8aacce8163086f27ce1666cd /LedgerSMB
parent0b640c457af0db54ee79857ff15d81055280a5b8 (diff)
Set database connections to utf8
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1121 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rw-r--r--LedgerSMB/Form.pm2
-rw-r--r--LedgerSMB/RESTXML/Handler.pm1
-rw-r--r--LedgerSMB/Sysconfig.pm1
-rw-r--r--LedgerSMB/User.pm13
4 files changed, 17 insertions, 0 deletions
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index e789ed57..ef997711 100644
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -1581,6 +1581,7 @@ sub dbconnect {
my $dbh = DBI->connect( $myconfig->{dbconnect},
$myconfig->{dbuser}, $myconfig->{dbpasswd} )
or $self->dberror;
+ $dbh->{pg_enable_utf8} = 1;
# set db options
if ( $myconfig->{dboptions} ) {
@@ -1600,6 +1601,7 @@ sub dbconnect_noauto {
$myconfig->{dbconnect}, $myconfig->{dbuser},
$myconfig->{dbpasswd}, { AutoCommit => 0 }
) or $self->dberror;
+ $dbh->{pg_enable_utf8} = 1;
# set db options
if ( $myconfig->{dboptions} ) {
diff --git a/LedgerSMB/RESTXML/Handler.pm b/LedgerSMB/RESTXML/Handler.pm
index 0939da7f..ab63ad2a 100644
--- a/LedgerSMB/RESTXML/Handler.pm
+++ b/LedgerSMB/RESTXML/Handler.pm
@@ -124,6 +124,7 @@ sub connect_db {
my $dbh = DBI->connect( $myconfig->{dbconnect},
$myconfig->{dbuser}, $myconfig->{dbpasswd} )
or carp "Error connecting to the db :$DBI::errstr";
+ $dbh->{pg_enable_utf8} = 1;
return $dbh;
}
diff --git a/LedgerSMB/Sysconfig.pm b/LedgerSMB/Sysconfig.pm
index e2b8c09d..e01618cc 100644
--- a/LedgerSMB/Sysconfig.pm
+++ b/LedgerSMB/Sysconfig.pm
@@ -125,6 +125,7 @@ if ( $config{globaldb}{DBname} ) {
$form = new Form;
$form->error("No GlobalDBH Configured or Could not Connect");
}
+ $GLOBALDBH->{pg_enable_utf8} = 1;
}
# These lines prevent other apps in mod_perl from seeing the global db
diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm
index c24eb98f..e9600deb 100644
--- a/LedgerSMB/User.pm
+++ b/LedgerSMB/User.pm
@@ -196,6 +196,7 @@ sub login {
DBI->connect( $myconfig{dbconnect}, $myconfig{dbuser},
$myconfig{dbpasswd} )
or $self->error( __FILE__ . ':' . __LINE__ . ': ' . $DBI::errstr );
+ $dbh->{pg_enable_utf8} = 1;
# we got a connection, check the version
my $query = qq|
@@ -263,6 +264,7 @@ sub check_recurring {
my $dbh =
DBI->connect( $self->{dbconnect}, $self->{dbuser}, $self->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_encode_utf8} = 1;
my $query = qq|
SELECT count(*) FROM recurring
@@ -319,6 +321,7 @@ sub dbsources {
my $dbh =
DBI->connect( $form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
if ( $form->{dbdriver} eq 'Pg' ) {
@@ -337,6 +340,7 @@ sub dbsources {
DBI->connect( $form->{dbconnect}, $form->{dbuser},
$form->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
$query = qq|
SELECT tablename FROM pg_tables
@@ -380,6 +384,7 @@ sub dbcreate {
DBI->connect( $form->{dbconnect}, $form->{dbsuperuser},
$form->{dbsuperpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $superdbh->{pg_enable_utf8} = 1;
my $query = qq|$dbcreate{$form->{dbdriver}}|;
$superdbh->do($query)
|| $form->dberror( __FILE__ . ':' . __LINE__ . $query );
@@ -394,11 +399,13 @@ sub dbcreate {
my $dbh =
DBI->connect( $form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
if ( $form->{dbsuperuser} ) {
my $superdbh =
DBI->connect( $form->{dbconnect}, $form->{dbsuperuser},
$form->{dbsuperpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $superdbh->{pg_enable_utf8} = 1;
# JD: We need to check for plpgsql,
# if it isn't there create it, if we can't error
@@ -470,6 +477,7 @@ sub dbdelete {
my $dbh =
DBI->connect( $form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
my $query = qq|DROP DATABASE "$form->{db}"|;
$dbh->do($query) || $form->dberror( __FILE__ . ':' . __LINE__ . $query );
@@ -526,6 +534,7 @@ sub dbneedsupdate {
my $dbh =
DBI->connect( $form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
if ( $form->{dbdriver} =~ /Pg/ ) {
@@ -548,6 +557,7 @@ sub dbneedsupdate {
DBI->connect( $form->{dbconnect}, $form->{dbuser},
$form->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8};
$query = qq|
SELECT tablename
@@ -613,6 +623,7 @@ sub dbupdate {
$form->{dbconnect}, $form->{dbuser},
$form->{dbpasswd}, { AutoCommit => 0 }
) or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
# check version
$query = qq|
@@ -842,6 +853,7 @@ sub save_member {
$self->{dbconnect}, $self->{dbuser},
$self->{dbpasswd}, { AutoCommit => 0 }
) or $self->error($DBI::errstr);
+ $dbh->{pg_enable_utf8} = 1;
# add login to employees table if it does not exist
my $login = $self->{login};
@@ -895,6 +907,7 @@ sub delete_login {
$form->{dbconnect}, $form->{dbuser},
$form->{dbpasswd}, { AutoCommit => 0 }
) or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
my $login = $form->{login};
$login =~ s/@.*//;