From aea50e915a44165daa946b4db75a2e2d754b78ec Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 22 Jun 2015 19:19:59 +0200 Subject: [PATCH] Fix to the date insertion when processing schema files --- pandora_console/include/db/oracle.php | 15 +++++++++++++++ pandora_console/install.php | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/pandora_console/include/db/oracle.php b/pandora_console/include/db/oracle.php index 5cc00771b2..1f73131ad2 100644 --- a/pandora_console/include/db/oracle.php +++ b/pandora_console/include/db/oracle.php @@ -1530,6 +1530,21 @@ function oracle_db_process_file ($path, $handle_error = true) { // Begin the transaction oracle_db_process_sql_begin(); + $datetime_tz_format = oci_parse($connection, 'alter session set NLS_TIMESTAMP_TZ_FORMAT =\'YYYY-MM-DD HH24:MI:SS\''); + $datetime_format = oci_parse($connection, 'alter session set NLS_TIMESTAMP_FORMAT =\'YYYY-MM-DD HH24:MI:SS\''); + $date_format = oci_parse($connection, 'alter session set NLS_DATE_FORMAT =\'YYYY-MM-DD HH24:MI:SS\''); + $decimal_separator = oci_parse($connection, 'alter session set NLS_NUMERIC_CHARACTERS =\',.\''); + + oci_execute($datetime_tz_format); + oci_execute($datetime_format); + oci_execute($date_format); + oci_execute($decimal_separator); + + oci_free_statement($datetime_tz_format); + oci_free_statement($datetime_format); + oci_free_statement($date_format); + oci_free_statement($decimal_separator); + foreach ($file_content as $sql_line) { $clean_line = trim($sql_line); $comment = preg_match("/^(\s|\t)*--.*$/", $clean_line); diff --git a/pandora_console/install.php b/pandora_console/install.php index e5f844856a..c43611ce80 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -283,6 +283,21 @@ function parse_oracle_dump($connection, $url, $debug = false) { $query = ""; $plsql_block = false; + $datetime_tz_format = oci_parse($connection, 'alter session set NLS_TIMESTAMP_TZ_FORMAT =\'YYYY-MM-DD HH24:MI:SS\''); + $datetime_format = oci_parse($connection, 'alter session set NLS_TIMESTAMP_FORMAT =\'YYYY-MM-DD HH24:MI:SS\''); + $date_format = oci_parse($connection, 'alter session set NLS_DATE_FORMAT =\'YYYY-MM-DD HH24:MI:SS\''); + $decimal_separator = oci_parse($connection, 'alter session set NLS_NUMERIC_CHARACTERS =\',.\''); + + oci_execute($datetime_tz_format); + oci_execute($datetime_format); + oci_execute($date_format); + oci_execute($decimal_separator); + + oci_free_statement($datetime_tz_format); + oci_free_statement($datetime_format); + oci_free_statement($date_format); + oci_free_statement($decimal_separator); + foreach ($file_content as $sql_line) { $clean_line = trim($sql_line); $comment = preg_match("/^(\s|\t)*--.*$/", $clean_line);