next if ($control->{ignore});
$control->{charset} = 'UTF-8' if $file =~ m/\.pl$/;
- $control->{charset} = $control->{charset} || $control->{encoding} || Common::DEFAULT_CHARSET;
+ $control->{charset} = $control->{charset} || $control->{encoding} || 'UTF-8';
if (!$control->{"tag"}) {
_control_error($form, $file_name, $locale->text("Missing 'tag' field.")) ;
sub process_query {
$::lxdebug->enter_sub();
- my ($self, $dbh, $filename, $version_or_control, $db_charset) = @_;
+ my ($self, $dbh, $filename, $version_or_control) = @_;
my $form = $self->{form};
my $fh = IO::File->new($filename, "r") or $form->error("$filename : $!\n");
my $sth;
my @quote_chars;
- my $file_charset = Common::DEFAULT_CHARSET;
+ my $file_charset = 'UTF-8';
while (<$fh>) {
last if !/^--/;
next if !/^--\s*\@(?:charset|encoding):\s*(.+)/;
}
$fh->seek(0, SEEK_SET);
- $db_charset ||= Common::DEFAULT_CHARSET;
-
$dbh->begin_work();
while (<$fh>) {
- $_ = SL::Iconv::convert($file_charset, $db_charset, $_);
+ $_ = SL::Iconv::convert($file_charset, 'UTF-8', $_);
# Remove DOS and Unix style line endings.
chomp;
sub process_perl_script {
$::lxdebug->enter_sub();
- my ($self, $dbh, $filename, $version_or_control, $db_charset) = @_;
+ my ($self, $dbh, $filename, $version_or_control) = @_;
my %form_values = map { $_ => $::form->{$_} } qw(dbconnect dbdefault dbhost dbmbkiviunstable dbname dboptions dbpasswd dbport dbupdate dbuser login template_object version);
}
sub process_file {
- my ($self, $dbh, $filename, $version_or_control, $db_charset) = @_;
+ my ($self, $dbh, $filename, $version_or_control) = @_;
if ($filename =~ m/sql$/) {
- $self->process_query($dbh, $filename, $version_or_control, $db_charset);
+ $self->process_query($dbh, $filename, $version_or_control);
} else {
- $self->process_perl_script($dbh, $filename, $version_or_control, $db_charset);
+ $self->process_perl_script($dbh, $filename, $version_or_control);
}
}
return 0 if !@unapplied_scripts;
- my $db_charset = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET;
$self->{form}->{login} ||= 'admin';
- map { $_->{description} = SL::Iconv::convert($_->{charset}, $db_charset, $_->{description}) } values %{ $self->{all_controls} };
+ map { $_->{description} = SL::Iconv::convert($_->{charset}, 'UTF-8', $_->{description}) } values %{ $self->{all_controls} };
if ($called_from_admin) {
$self->{form}->{title} = $::locale->text('Dataset upgrade');
$::lxdebug->message(LXDebug->DEBUG2(), "Applying Update $control->{file}");
print $self->{form}->parse_html_template("dbupgrade/upgrade_message2", $control);
- $self->process_file($dbh, "sql/Pg-upgrade2-auth/$control->{file}", $control, $db_charset);
+ $self->process_file($dbh, "sql/Pg-upgrade2-auth/$control->{file}", $control);
}
print $self->{form}->parse_html_template("dbupgrade/footer", { is_admin => 1 }) if $called_from_admin;
found). Sets C<$Self->{all_controls}> to the list of database
scripts.
-=item C<process_file $dbh, $filename, $version_or_control, $db_charset>
+=item C<process_file $dbh, $filename, $version_or_control>
Applies a single database upgrade file. Calls L<process_perl_script>
for Perl update files and C<process_query> for SQL update
files. Requires an open database handle(C<$dbh>), the file name
-(C<$filename>), a hash structure of the file's control fields as
-produced by L<parse_dbupdate_controls> (C<$version_or_control>) and
-the database charset (for on-the-fly charset recoding of the script if
-required, C<$db_charset>).
+(C<$filename>) and a hash structure of the file's control fields as
+produced by L<parse_dbupdate_controls> (C<$version_or_control>).
Returns the result of the actual function called.
-=item C<process_perl_script $dbh, $filename, $version_or_control, $db_charset>
+=item C<process_perl_script $dbh, $filename, $version_or_control>
Applies a single Perl database upgrade file. Requires an open database
-handle(C<$dbh>), the file name (C<$filename>), a hash structure of the
-file's control fields as produced by L<parse_dbupdate_controls>
-(C<$version_or_control>) and the database charset (for on-the-fly
-charset recoding of the script if required, C<$db_charset>).
+handle(C<$dbh>), the file name (C<$filename>) and a hash structure of
+the file's control fields as produced by L<parse_dbupdate_controls>
+(C<$version_or_control>).
Perl scripts are executed via L<eval>. If L<eval> returns falsish then
an error is expected. There are two special return values: If the
}
}
-=item C<process_query $dbh, $filename, $version_or_control, $db_charset>
+=item C<process_query $dbh, $filename, $version_or_control>
Applies a single SQL database upgrade file. Requires an open database
-handle(C<$dbh>), the file name (C<$filename>), a hash structure of the
-ofile's control fields as produced by L<parse_dbupdate_controls>
-(C<$version_or_control>) and the database charset (for on-the-fly
-charset recoding of the script if required, C<$db_charset>).
+handle(C<$dbh>), the file name (C<$filename>), and a hash structure of
+the file's control fields as produced by L<parse_dbupdate_controls>
+(C<$version_or_control>).
=item C<sort_dbupdate_controls>