...und gegen das hardcodierte Werte für PostgreSQL ersetzt.
my $sortorder = join ', ',
$form->sort_columns(qw(transdate reference description));
- my $false = ($myconfig->{dbdriver} eq 'Pg') ? "FALSE" : q|'0'|;
-
- # Oracle workaround, use ordinal positions
- my %ordinal = (transdate => 4,
- reference => 2,
- description => 3);
- map { $sortorder =~ s/$_/$ordinal{$_}/ } keys %ordinal;
my ($null, $department_id) = split(/--/, $form->{department});
my ($dpt_where, $dpt_join, @department_values);
# get all transactions
$query =
qq|SELECT a.id, a.reference, a.description, ac.transdate, ac.chart_id, | .
- qq| $false AS invoice, ac.amount, 'gl' as module, | .
+ qq| FALSE AS invoice, ac.amount, 'gl' as module, | .
qq§(SELECT accno||'--'||rate FROM tax LEFT JOIN chart ON (tax.chart_id=chart.id) WHERE tax.id = (SELECT tax_id FROM taxkeys WHERE taxkey_id = ac.taxkey AND taxkeys.startdate <= ac.transdate ORDER BY taxkeys.startdate DESC LIMIT 1)) AS taxinfo, ac.source || ' ' || ac.memo AS memo § .
qq|FROM acc_trans ac, gl a | .
$dpt_join .
}
sub apply_dbupgrade_scripts {
- return SL::DBUpgrade2->new(form => $::form, dbdriver => 'Pg', auth => 1)->apply_admin_dbupgrade_scripts(1);
+ return SL::DBUpgrade2->new(form => $::form, auth => 1)->apply_admin_dbupgrade_scripts(1);
}
sub authenticate_root {
$params{path_suffix} ||= '';
$params{schema} ||= '';
- $params{path} = "sql/" . $params{dbdriver} . "-upgrade2" . $params{path_suffix};
+ $params{path} = "sql/Pg-upgrade2" . $params{path_suffix};
map { $self->{$_} = $params{$_} } keys %params;
my ($self, $dbh, $filename, $version_or_control, $db_charset) = @_;
- my %form_values = map { $_ => $::form->{$_} } qw(dbconnect dbdefault dbdriver dbhost dbmbkiviunstable dbname dboptions dbpasswd dbport dbupdate dbuser login template_object version);
+ my %form_values = map { $_ => $::form->{$_} } qw(dbconnect dbdefault dbhost dbmbkiviunstable dbname dboptions dbpasswd dbport dbupdate dbuser login template_object version);
$dbh->begin_work;
local *SQLDIR;
- my $dbdriver = $self->{dbdriver};
- opendir SQLDIR, "sql/${dbdriver}-upgrade" || error("", "sql/${dbdriver}-upgrade: $!");
- my @upgradescripts = grep /${dbdriver}-upgrade-\Q$cur_version\E.*\.(sql|pl)$/, readdir SQLDIR;
+ opendir SQLDIR, "sql/Pg-upgrade" || error("", "sql/Pg-upgrade: $!");
+ my @upgradescripts = grep /Pg-upgrade-\Q$cur_version\E.*\.(sql|pl)$/, readdir SQLDIR;
closedir SQLDIR;
return ($#upgradescripts > -1);
$::lxdebug->message(LXDebug->DEBUG2(), "Applying Update $control->{file}");
print $self->{form}->parse_html_template("dbupgrade/upgrade_message2", $control);
- $self->process_file($dbh, "sql/$self->{dbdriver}-upgrade2-auth/$control->{file}", $control, $db_charset);
+ $self->process_file($dbh, "sql/Pg-upgrade2-auth/$control->{file}", $control, $db_charset);
}
print $self->{form}->parse_html_template("dbupgrade/footer", { is_admin => 1 }) if $called_from_admin;
# Apply outstanding updates to the authentication database
my $scripts = SL::DBUpgrade2->new(
form => $::form,
- dbdriver => 'Pg',
auth => 1
);
$scripts->apply_admin_dbupgrade_scripts(1);
# Apply updates to a user database
my $scripts = SL::DBUpgrade2->new(
form => $::form,
- dbdriver => $::form->{dbdriver},
auth => 1
);
User->dbupdate2($form, $scripts->parse_dbupdate_controls);
C<SL::Form> object to use. Required.
-=item dbdriver
-
-Name of the database driver. Currently only C<Pg> for PostgreSQL is
-supported.
-
=item auth
Optional parameter defaulting to 0. If trueish then the scripts read
delete $form->{id};
}
- my %oid = ('Pg' => 'oid',
- 'Oracle' => 'rowid');
-
# retrieve individual items
# this query looks up all information about the items
# stuff different from the whole will not be overwritten, but saved with a suffix.
LEFT JOIN project pr ON (doi.project_id = pr.id)
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
WHERE doi.delivery_order_id IN ($do_ids_placeholders)
- ORDER BY doi.$oid{$myconfig->{dbdriver}}|;
+ ORDER BY doi.oid|;
$form->{form_details} = selectall_hashref_query($form, $dbh, $query, @do_ids);
my $partsgroup;
my $position = 0;
- my %oid = ('Pg' => 'oid',
- 'Oracle' => 'rowid');
-
my (@project_ids, %projectnumbers, %projectdescriptions);
push(@project_ids, $form->{"globalproject_id"}) if ($form->{"globalproject_id"});
my $sortorder = "";
if ($form->{groupitems}) {
$sortorder =
- qq|ORDER BY pg.partsgroup, a.$oid{$myconfig->{dbdriver}}|;
+ qq|ORDER BY pg.partsgroup, a.oid|;
} else {
- $sortorder = qq|ORDER BY a.$oid{$myconfig->{dbdriver}}|;
+ $sortorder = qq|ORDER BY a.oid|;
}
do_statement($form, $h_pg, $q_pg, conv_i($form->{"id_$i"}));
}
}
- my $false = ($myconfig->{dbdriver} eq 'Pg') ? "FALSE" : q|'0'|;
-
my %sort_columns = (
'id' => [ qw(id) ],
'transdate' => [ qw(transdate id) ],
$query =
qq|SELECT
- ac.acc_trans_id, g.id, 'gl' AS type, $false AS invoice, g.reference, ac.taxkey, c.link,
+ ac.acc_trans_id, g.id, 'gl' AS type, FALSE AS invoice, g.reference, ac.taxkey, c.link,
g.description, ac.transdate, ac.gldate, ac.source, ac.trans_id,
ac.amount, c.accno, g.notes, t.chart_id,
CASE WHEN (COALESCE(e.name, '') = '') THEN e.login ELSE e.name END AS employee
my $i;
my @partsgroup = ();
my $partsgroup;
- my %oid = ('Pg' => 'oid',
- 'Oracle' => 'rowid');
# sort items by partsgroup
for $i (1 .. $form->{rowcount}) {
my $sortorder = "";
if ($form->{groupitems}) {
$sortorder =
- qq|ORDER BY pg.partsgroup, a.$oid{$myconfig->{dbdriver}}|;
+ qq|ORDER BY pg.partsgroup, a.oid|;
} else {
- $sortorder = qq|ORDER BY a.$oid{$myconfig->{dbdriver}}|;
+ $sortorder = qq|ORDER BY a.oid|;
}
$query =
map { $form->{$_} =~ s/ +$//g } qw(printed emailed queued);
} # if !@ids
- my %oid = ('Pg' => 'oid',
- 'Oracle' => 'rowid');
-
my $transdate = $form->{transdate} ? $dbh->quote($form->{transdate}) : "current_date";
$form->{taxzone_id} = 0 unless ($form->{taxzone_id});
($form->{id}
? qq|WHERE o.trans_id = ?|
: qq|WHERE o.trans_id IN (| . join(", ", map("?", @ids)) . qq|)|) .
- qq|ORDER BY o.$oid{$myconfig->{dbdriver}}|;
+ qq|ORDER BY o.oid|;
@ids = $form->{id} ? ($form->{id}) : @ids;
$sth = prepare_execute_query($form, $dbh, $query, @values);
my $tax_rate;
my $taxamount;
-
- my %oid = ('Pg' => 'oid',
- 'Oracle' => 'rowid');
-
my (@project_ids, %projectnumbers, %projectdescriptions);
push(@project_ids, $form->{"globalproject_id"}) if ($form->{"globalproject_id"});
# get parts and push them onto the stack
my $sortorder = "";
if ($form->{groupitems}) {
- $sortorder = qq|ORDER BY pg.partsgroup, a.$oid{$myconfig->{dbdriver}}|;
+ $sortorder = qq|ORDER BY pg.partsgroup, a.oid|;
} else {
- $sortorder = qq|ORDER BY a.$oid{$myconfig->{dbdriver}}|;
+ $sortorder = qq|ORDER BY a.oid|;
}
$query = qq|SELECT p.partnumber, p.description, p.unit, a.qty, | .
($form->{beginningbalance}, $form->{category}) =
selectrow_query($form, $dbh, $query, @values);
- my %oid = ('Pg' => 'ac.acc_trans_id',
- 'Oracle' => 'ac.rowid');
@values = ();
$query =
qq|SELECT c.name, ac.source, ac.transdate, ac.cleared, | .
qq| ac.fx_transaction, ac.amount, a.id, | .
- qq| $oid{$myconfig->{dbdriver}} AS oid | .
+ qq| ac.acc_trans_id AS oid | .
qq|FROM customer c, acc_trans ac, ar a, chart ch | .
qq|WHERE c.id = a.customer_id | .
qq| AND ac.cleared = '0' | .
qq|SELECT v.name, ac.source, ac.transdate, ac.cleared, | .
qq| ac.fx_transaction, ac.amount, a.id, | .
- qq| $oid{$myconfig->{dbdriver}} AS oid | .
+ qq| ac.acc_trans_id AS oid | .
qq|FROM vendor v, acc_trans ac, ap a, chart ch | .
qq|WHERE v.id = a.vendor_id | .
qq| AND ac.cleared = '0' | .
qq|SELECT g.description, ac.source, ac.transdate, ac.cleared, | .
qq| ac.fx_transaction, ac.amount, g.id, | .
- qq| $oid{$myconfig->{dbdriver}} AS oid | .
+ qq| ac.acc_trans_id AS oid | .
qq|FROM gl g, acc_trans ac, chart ch | .
qq|WHERE g.id = ac.trans_id | .
qq| AND ac.cleared = '0' | .
my $dbh = $form->dbconnect($myconfig);
my ($query, $i);
- my %oid = ('Pg' => 'acc_trans_id',
- 'Oracle' => 'rowid');
# clear flags
for $i (1 .. $form->{rowcount}) {
if ($form->{"cleared_$i"}) {
$query =
qq|UPDATE acc_trans SET cleared = '1' | .
- qq|WHERE $oid{$myconfig->{dbdriver}} = ?|;
+ qq|WHERE acc_trans_id = ?|;
do_query($form, $dbh, $query, $form->{"oid_$i"});
# clear fx_transaction
if ($form->{"fxoid_$i"}) {
$query =
qq|UPDATE acc_trans SET cleared = '1' | .
- qq|WHERE $oid{$myconfig->{dbdriver}} = ?|;
+ qq|WHERE acc_trans_id = ?|;
do_query($form, $dbh, $query, $form->{"fxoid_$i"});
}
}
sub login {
my ($self, $form) = @_;
- our $sid;
return -3 if !$self->{login} || !$::auth->client;
my $dbh = $form->dbconnect_noauto;
# we got a connection, check the version
- my $query = qq|SELECT version FROM defaults|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my ($dbversion) = $sth->fetchrow_array;
- $sth->finish;
+ my ($dbversion) = $dbh->selectrow_array(qq|SELECT version FROM defaults|);
$self->create_employee_entry($form, $dbh, \%myconfig);
$self->create_schema_info_table($form, $dbh);
# Auth DB upgrades available?
- my $dbupdater_auth = SL::DBUpgrade2->new(form => $form, dbdriver => 'Pg', auth => 1)->parse_dbupdate_controls;
+ my $dbupdater_auth = SL::DBUpgrade2->new(form => $form, auth => 1)->parse_dbupdate_controls;
return -3 if $dbupdater_auth->unapplied_upgrade_scripts($::auth->dbconnect);
- my $dbupdater = SL::DBUpgrade2->new(form => $form, dbdriver => $myconfig{dbdriver})->parse_dbupdate_controls;
+ my $dbupdater = SL::DBUpgrade2->new(form => $form)->parse_dbupdate_controls;
$form->{$_} = $::auth->client->{$_} for qw(dbname dbhost dbport dbuser dbpasswd);
$form->{$_} = $myconfig{$_} for qw(dateformat);
$self->dbupdate($form);
$self->dbupdate2($form, $dbupdater);
- SL::DBUpgrade2->new(form => $::form, dbdriver => 'Pg', auth => 1)->apply_admin_dbupgrade_scripts(0);
+ SL::DBUpgrade2->new(form => $::form, auth => 1)->apply_admin_dbupgrade_scripts(0);
close($fh);
my ($form, $db) = @_;
my %dboptions = (
- 'Pg' => { 'yy-mm-dd' => 'set DateStyle to \'ISO\'',
- 'yyyy-mm-dd' => 'set DateStyle to \'ISO\'',
- 'mm/dd/yy' => 'set DateStyle to \'SQL, US\'',
- 'dd/mm/yy' => 'set DateStyle to \'SQL, EUROPEAN\'',
- 'dd.mm.yy' => 'set DateStyle to \'GERMAN\''
- },
- 'Oracle' => {
- 'yy-mm-dd' => 'ALTER SESSION SET NLS_DATE_FORMAT = \'YY-MM-DD\'',
- 'yyyy-mm-dd' => 'ALTER SESSION SET NLS_DATE_FORMAT = \'YYYY-MM-DD\'',
- 'mm/dd/yy' => 'ALTER SESSION SET NLS_DATE_FORMAT = \'MM/DD/YY\'',
- 'dd/mm/yy' => 'ALTER SESSION SET NLS_DATE_FORMAT = \'DD/MM/YY\'',
- 'dd.mm.yy' => 'ALTER SESSION SET NLS_DATE_FORMAT = \'DD.MM.YY\'',
- });
-
- $form->{dboptions} = $dboptions{ $form->{dbdriver} }{ $form->{dateformat} };
-
- if ($form->{dbdriver} eq 'Pg') {
- $form->{dbconnect} = "dbi:Pg:dbname=$db";
- }
-
- if ($form->{dbdriver} eq 'Oracle') {
- $form->{dbconnect} = "dbi:Oracle:sid=$form->{sid}";
- }
-
- if ($form->{dbhost}) {
- $form->{dbconnect} .= ";host=$form->{dbhost}";
- }
- if ($form->{dbport}) {
- $form->{dbconnect} .= ";port=$form->{dbport}";
- }
-
- $main::lxdebug->leave_sub();
-}
-
-sub dbdrivers {
- $main::lxdebug->enter_sub();
+ 'yy-mm-dd' => 'set DateStyle to \'ISO\'',
+ 'yyyy-mm-dd' => 'set DateStyle to \'ISO\'',
+ 'mm/dd/yy' => 'set DateStyle to \'SQL, US\'',
+ 'dd/mm/yy' => 'set DateStyle to \'SQL, EUROPEAN\'',
+ 'dd.mm.yy' => 'set DateStyle to \'GERMAN\''
+ );
- my @drivers = DBI->available_drivers();
+ $form->{dboptions} = $dboptions{ $form->{dateformat} };
+ $form->{dbconnect} = "dbi:Pg:dbname=${db};host=" . ($form->{dbhost} || 'localhost') . ";port=" . ($form->{dbport} || 5432);
$main::lxdebug->leave_sub();
-
- return (grep { /(Pg|Oracle)/ } @drivers);
}
sub dbsources {
my ($sth, $query);
$form->{dbdefault} = $form->{dbuser} unless $form->{dbdefault};
- $form->{sid} = $form->{dbdefault};
&dbconnect_vars($form, $form->{dbdefault});
my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
or $form->dberror;
- if ($form->{dbdriver} eq 'Pg') {
- $query =
- qq|SELECT datname FROM pg_database | .
- qq|WHERE NOT datname IN ('template0', 'template1')|;
- $sth = $dbh->prepare($query);
- $sth->execute() || $form->dberror($query);
-
- while (my ($db) = $sth->fetchrow_array) {
-
- if ($form->{only_acc_db}) {
-
- next if ($db =~ /^template/);
-
- &dbconnect_vars($form, $db);
- my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
- or $form->dberror;
-
- $query =
- qq|SELECT tablename FROM pg_tables | .
- qq|WHERE (tablename = 'defaults') AND (tableowner = ?)|;
- my $sth = $dbh->prepare($query);
- $sth->execute($form->{dbuser}) ||
- $form->dberror($query . " ($form->{dbuser})");
-
- if ($sth->fetchrow_array) {
- push(@dbsources, $db);
- }
- $sth->finish;
- $dbh->disconnect;
- next;
- }
- push(@dbsources, $db);
- }
- }
+ $query =
+ qq|SELECT datname FROM pg_database | .
+ qq|WHERE NOT datname IN ('template0', 'template1')|;
+ $sth = $dbh->prepare($query);
+ $sth->execute() || $form->dberror($query);
+
+ while (my ($db) = $sth->fetchrow_array) {
- if ($form->{dbdriver} eq 'Oracle') {
if ($form->{only_acc_db}) {
- $query =
- qq|SELECT owner FROM dba_objects | .
- qq|WHERE object_name = 'DEFAULTS' AND object_type = 'TABLE'|;
- } else {
- $query = qq|SELECT username FROM dba_users|;
- }
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ next if ($db =~ /^template/);
+
+ &dbconnect_vars($form, $db);
+ my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
+ or $form->dberror;
- while (my ($db) = $sth->fetchrow_array) {
- push(@dbsources, $db);
+ $query =
+ qq|SELECT tablename FROM pg_tables | .
+ qq|WHERE (tablename = 'defaults') AND (tableowner = ?)|;
+ my $sth = $dbh->prepare($query);
+ $sth->execute($form->{dbuser}) ||
+ $form->dberror($query . " ($form->{dbuser})");
+
+ if ($sth->fetchrow_array) {
+ push(@dbsources, $db);
+ }
+ $sth->finish;
+ $dbh->disconnect;
+ next;
}
+ push(@dbsources, $db);
}
$sth->finish;
my ($self, $form) = @_;
- $form->{sid} = $form->{dbdefault};
&dbconnect_vars($form, $form->{dbdefault});
my $dbh =
SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
or $form->dberror;
$form->{db} =~ s/\"//g;
- my %dbcreate = (
- 'Pg' => qq|CREATE DATABASE "$form->{db}"|,
- 'Oracle' =>
- qq|CREATE USER "$form->{db}" DEFAULT TABLESPACE USERS | .
- qq|TEMPORARY TABLESPACE TEMP IDENTIFIED BY "$form->{db}"|
- );
- my %dboptions = (
- 'Pg' => [],
- );
+ my @dboptions;
- push(@{$dboptions{"Pg"}}, "ENCODING = " . $dbh->quote($form->{"encoding"}))
- if ($form->{"encoding"});
+ push @dboptions, "ENCODING = " . $dbh->quote($form->{"encoding"}) if $form->{"encoding"};
if ($form->{"dbdefault"}) {
my $dbdefault = $form->{"dbdefault"};
$dbdefault =~ s/[^a-zA-Z0-9_\-]//g;
- push(@{$dboptions{"Pg"}}, "TEMPLATE = $dbdefault");
+ push @dboptions, "TEMPLATE = $dbdefault";
}
- my $query = $dbcreate{$form->{dbdriver}};
- $query .= " WITH " . join(" ", @{$dboptions{"Pg"}}) if (@{$dboptions{"Pg"}});
+ my $query = qq|CREATE DATABASE "$form->{db}"|;
+ $query .= " WITH " . join(" ", @dboptions) if @dboptions;
# Ignore errors if the database exists.
$dbh->do($query);
- if ($form->{dbdriver} eq 'Oracle') {
- $query = qq|GRANT CONNECT, RESOURCE TO "$form->{db}"|;
- do_query($form, $dbh, $query);
- }
$dbh->disconnect;
- # setup variables for the new database
- if ($form->{dbdriver} eq 'Oracle') {
- $form->{dbuser} = $form->{db};
- $form->{dbpasswd} = $form->{db};
- }
-
&dbconnect_vars($form, $form->{db});
$dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
my $db_charset = $Common::db_encoding_to_charset{$form->{encoding}};
$db_charset ||= Common::DEFAULT_CHARSET;
- my $dbupdater = SL::DBUpgrade2->new(form => $form, dbdriver => $form->{dbdriver});
+ my $dbupdater = SL::DBUpgrade2->new(form => $form);
# create the tables
$dbupdater->process_query($dbh, "sql/lx-office.sql", undef, $db_charset);
my ($self, $form) = @_;
$form->{db} =~ s/\"//g;
- my %dbdelete = ('Pg' => qq|DROP DATABASE "$form->{db}"|,
- 'Oracle' => qq|DROP USER "$form->{db}" CASCADE|);
- $form->{sid} = $form->{dbdefault};
&dbconnect_vars($form, $form->{dbdefault});
my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
or $form->dberror;
- my $query = $dbdelete{$form->{dbdriver}};
+ my $query = qq|DROP DATABASE "$form->{db}"|;
do_query($form, $dbh, $query);
$dbh->disconnect;
my ($self, $form) = @_;
my %members = $main::auth->read_all_users();
- my $dbupdater = SL::DBUpgrade2->new(form => $form, dbdriver => $form->{dbdriver})->parse_dbupdate_controls;
+ my $dbupdater = SL::DBUpgrade2->new(form => $form)->parse_dbupdate_controls;
my ($query, $sth, %dbs_needing_updates);
local *SQLDIR;
- $form->{sid} = $form->{dbdefault};
-
my @upgradescripts = ();
my $query;
my $rc = -2;
if ($form->{dbupdate}) {
# read update scripts into memory
- opendir(SQLDIR, "sql/" . $form->{dbdriver} . "-upgrade")
- or &error("", "sql/" . $form->{dbdriver} . "-upgrade : $!");
+ opendir(SQLDIR, "sql/Pg-upgrade")
+ or &error("", "sql/Pg-upgrade : $!");
@upgradescripts =
sort(cmp_script_version
- grep(/$form->{dbdriver}-upgrade-.*?\.(sql|pl)$/,
+ grep(/Pg-upgrade-.*?\.(sql|pl)$/,
readdir(SQLDIR)));
closedir(SQLDIR);
}
my $db_charset = $::lx_office_conf{system}->{dbcharset};
$db_charset ||= Common::DEFAULT_CHARSET;
- my $dbupdater = SL::DBUpgrade2->new(form => $form, dbdriver => $form->{dbdriver});
+ my $dbupdater = SL::DBUpgrade2->new(form => $form);
foreach my $db (split(/ /, $form->{dbupdate})) {
foreach my $upgradescript (@upgradescripts) {
my $a = $upgradescript;
- $a =~ s/^\Q$form->{dbdriver}\E-upgrade-|\.(sql|pl)$//g;
+ $a =~ s/^Pg-upgrade-|\.(sql|pl)$//g;
my ($mindb, $maxdb) = split /-/, $a;
my $str_maxdb = $maxdb;
# apply upgrade
$main::lxdebug->message(LXDebug->DEBUG2(), "Applying Update $upgradescript");
- $dbupdater->process_file($dbh, "sql/" . $form->{"dbdriver"} . "-upgrade/$upgradescript", $str_maxdb, $db_charset);
+ $dbupdater->process_file($dbh, "sql/Pg-upgrade/$upgradescript", $str_maxdb, $db_charset);
$version = $maxdb;
my ($self, $form, $dbupdater) = @_;
- $form->{sid} = $form->{dbdefault};
-
my $rc = -2;
my $db_charset = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET;
$main::lxdebug->message(LXDebug->DEBUG2(), "Applying Update $control->{file}");
print $form->parse_html_template("dbupgrade/upgrade_message2", $control);
- $dbupdater->process_file($dbh, "sql/" . $form->{"dbdriver"} . "-upgrade2/$control->{file}", $control, $db_charset);
+ $dbupdater->process_file($dbh, "sql/Pg-upgrade2/$control->{file}", $control, $db_charset);
}
$rc = 0;
call_sub($locale->findsub($form->{action}));
}
} else {
- # if there are no drivers bail out
- $form->error($locale->text('No Database Drivers available!'))
- unless (User->dbdrivers);
-
adminlogin();
}
$::lxdebug->leave_sub;
sub pg_database_administration {
my $form = $main::form;
-
- $form->{dbdriver} = 'Pg';
dbselect_source();
-
}
sub dbselect_source {
my $form = $main::form;
my $locale = $main::locale;
- $form->{dbdriver} = 'Pg';
User::dbconnect_vars($form, $form->{dbname});
my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd});
restore_form($saved_form);
%::myconfig = ();
- map { $form->{$_} = $::myconfig{$_} = $form->{"${_}_${i}"} } qw(dbname dbdriver dbhost dbport dbuser dbpasswd);
+ map { $form->{$_} = $::myconfig{$_} = $form->{"${_}_${i}"} } qw(dbname dbhost dbport dbuser dbpasswd);
print $form->parse_html_template("admin/dbupgrade_header");
$form->{$form->{dbname}} = 1;
User->dbupdate($form);
- User->dbupdate2($form, SL::DBUpgrade2->new(form => $form, dbdriver => $form->{dbdriver})->parse_dbupdate_controls);
+ User->dbupdate2($form, SL::DBUpgrade2->new(form => $form)->parse_dbupdate_controls);
print $form->parse_html_template("admin/dbupgrade_footer");
}
print "Applying upgrade $control->{file}\n";
if ($file_type eq "sql") {
- $dbupgrader->process_query($dbh, "sql/$form->{dbdriver}-upgrade2/$control->{file}", $control, $db_charset);
+ $dbupgrader->process_query($dbh, "sql/Pg-upgrade2/$control->{file}", $control, $db_charset);
} else {
- $dbupgrader->process_perl_script($dbh, "sql/$form->{dbdriver}-upgrade2/$control->{file}", $control, $db_charset);
+ $dbupgrader->process_perl_script($dbh, "sql/Pg-upgrade2/$control->{file}", $control, $db_charset);
}
}
show_help() if ($opt_help);
-$dbupgrader = SL::DBUpgrade2->new(form => $form, dbdriver => 'Pg', auth => $opt_auth_db);
+$dbupgrader = SL::DBUpgrade2->new(form => $form, auth => $opt_auth_db);
$controls = $dbupgrader->parse_dbupdate_controls->{all_controls};
dump_list() if ($opt_list);
<form name="Form" method="post" action="admin.pl">
- <input type="hidden" name="dbdriver" value="Pg">
<input type="hidden" name="dbhost" value="[% HTML.escape(dbhost) %]">
<input type="hidden" name="dbport" value="[% HTML.escape(dbport) %]">
<input type="hidden" name="dbuser" value="[% HTML.escape(dbuser) %]">
</tr>
</table>
- <input type="hidden" name="dbdriver" value="[% HTML.escape(dbdriver) %]">
<input type="hidden" name="dbuser" value="[% HTML.escape(dbuser) %]">
<input type="hidden" name="dbhost" value="[% HTML.escape(dbhost) %]">
<input type="hidden" name="dbport" value="[% HTML.escape(dbport) %]">
<table>
- <input type="hidden" name="dbdriver" value="[% HTML.escape(dbdriver) %]">
-
<tr>
<td>
<table>
<select name="db">[% FOREACH row = DBSOURCES %]<option>[% HTML.escape(row.name) %]</option>[% END %]</select>
</p>
- <input type="hidden" name="dbdriver" value="[% HTML.escape(dbdriver) %]">
<input type="hidden" name="dbuser" value="[% HTML.escape(dbuser) %]">
<input type="hidden" name="dbhost" value="[% HTML.escape(dbhost) %]">
<input type="hidden" name="dbport" value="[% HTML.escape(dbport) %]">
<form name="Form" method="post" action="admin.pl" enctype="multipart/form-data">
- <input type="hidden" name="dbdriver" value="Pg">
<input type="hidden" name="dbhost" value="[% HTML.escape(dbhost) %]">
<input type="hidden" name="dbport" value="[% HTML.escape(dbport) %]">
<input type="hidden" name="dbuser" value="[% HTML.escape(dbuser) %]">
<table>
<tr>
<th class="listtop">[% 'Update?' | $T8 %]</th>
- <th class="listtop">[% 'Dataset' | $T8 %]</th>
<th class="listtop">[% 'Driver' | $T8 %]</th>
<th class="listtop">[% 'Host' | $T8 %]</th>
<th class="listtop">[% 'Port' | $T8 %]</th>
<input type="hidden" name="dbname_[% loop.count %]" value="[% HTML.escape(row.dbname) %]">
<label for="update_[% loop.count %]">[% HTML.escape(row.dbname) %]</label>
</td>
- <td><input type="hidden" name="dbdriver_[% loop.count %]" value="Pg">PostgreSQL</td>
<td><input type="hidden" name="dbhost_[% loop.count %]" value="[% HTML.escape(row.dbhost) %]">[% HTML.escape(row.dbhost) %]</td>
<td><input type="hidden" name="dbport_[% loop.count %]" value="[% HTML.escape(row.dbport) %]">[% HTML.escape(row.dbport) %]</td>
<td><input type="hidden" name="dbuser_[% loop.count %]" value="[% HTML.escape(row.dbuser) %]">[% HTML.escape(row.dbuser) %]</td>