From c261b73045a4af8da4e2625f8051ed9575afdaa9 Mon Sep 17 00:00:00 2001 From: Derek Schaefer Date: Wed, 2 Sep 2009 17:28:35 +0000 Subject: [PATCH] Improved the way the import destination is decided upon. --- libraries/import/ods.php | 3 ++- libraries/import/xml.php | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libraries/import/ods.php b/libraries/import/ods.php index 6711c1fe0..d10cf3365 100644 --- a/libraries/import/ods.php +++ b/libraries/import/ods.php @@ -262,13 +262,14 @@ for ($i = 0; $i < $len; ++$i) { /* Set database name to the currently selected one, if applicable */ if (strlen($db)) { $db_name = $db; + $options = array('create_db' => false); } else { $db_name = 'ODS_DB'; + $options = NULL; } /* Non-applicable parameters */ $create = NULL; -$options = NULL; /* Created and execute necessary SQL statements from data */ PMA_buildSQL($db_name, $tables, $analyses, $create, $options); diff --git a/libraries/import/xml.php b/libraries/import/xml.php index c29ee87d2..11cda94ae 100644 --- a/libraries/import/xml.php +++ b/libraries/import/xml.php @@ -278,11 +278,22 @@ if ($data_present) { * array $options = an associative array of options */ -/* Set database collation/charset */ -$options = array( +/* Set database name to the currently selected one, if applicable */ +if (strlen($db)) { + /* Override the database name in the XML file, if one is selected */ + $db_name = $db; + $options = array('create_db' => false); +} else { + if ($db_name === NULL) { + $db_name = 'XML_DB'; + } + + /* Set database collation/charset */ + $options = array( 'db_collation' => $collation, 'db_charset' => $charset, -); + ); +} /* Created and execute necessary SQL statements from data */ PMA_buildSQL($db_name, $tables, $analyses, $create, $options);