Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitffab4fd

Browse files
committed
Upgrade to ora2pg 1.10. Backpatch to 7.3.X.
1 parent30a800a commitffab4fd

File tree

4 files changed

+39
-16
lines changed

4 files changed

+39
-16
lines changed

‎contrib/oracle/CHANGES

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
by the schema name.
3939
- Fix output of Oracle data extraction. It now require a call to the function
4040
export_data().
41+
4142
2002 01 07 - Version 1.6
4243
- Fix problem exporting NULL value. Thanks to Stephane Schildknecht.
4344

@@ -49,3 +50,17 @@
4950
- Add column alias extraction on view. Thanks to Jean-Francois RIPOUTEAU
5051
- Add PACKAGE extraction (type => DATA).
5152

53+
2002 06 04 - Version 1.9
54+
- Fix a problem export data which fill NULL instead of 0 or empty string.
55+
Thanks to Jan Kester.
56+
- Add time with date when export data [ tochar('YYYY-MM-DD HH24:MI:SS') ].
57+
Thanks to Paolo Mattioli.
58+
59+
2002 07 29 - Version 1.10
60+
- Fix a problem with local settings regarding decimal separator (all ,
61+
are changed to .) Thank to Jan Kester.
62+
63+
Thanks for all congratulation message and bug report I received.
64+
65+
Gilles DAROLD <gilles@darold.net>
66+

‎contrib/oracle/Ora2Pg.pm

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ package Ora2Pg;
1717
use varsqw($VERSION $PSQL);
1818
use Carpqw(confess);
1919
use DBI;
20+
use POSIXqw(locale_h);
2021

21-
$VERSION ="1.8";
22+
#set locale to LC_NUMERIC C
23+
setlocale(LC_NUMERIC,"C");
24+
25+
26+
$VERSION ="1.9";
2227
$PSQL ="psql";
2328

2429
=head1NAME
@@ -854,7 +859,7 @@ print STDERR "Add triggers definition...\n" if ($self->{debug});
854859
# Escaping Single Quotes
855860
#$trig->[4] =~ s/'/''/sg;
856861

857-
$sql_output .="CREATE FUNCTION pg_fct_\L$trig->[0]\E () RETURNSTRIGGER AS '\n$trig->[4]\n' LANGUAGE 'plpgsql'\n\n";
862+
$sql_output .="CREATE FUNCTION pg_fct_\L$trig->[0]\E () RETURNSOPAQUE AS '\n$trig->[4]\n' LANGUAGE 'plpgsql'\n\n";
858863
$sql_output .="CREATE TRIGGER\L$trig->[0]\E\n\t$trig->[1]$trig->[2] ON\L$trig->[3]\E FOR EACH ROW\n\tEXECUTE PROCEDURE pg_fct_\L$trig->[0]\E();\n\n";
859864
}
860865
}
@@ -1002,7 +1007,7 @@ print STDERR "Dumping table $table...\n" if ($self->{debug});
10021007
if ($self->{type}ne'COPY') {
10031008
if ($tt[$i] =~/(char|date|time|text)/) {
10041009
$row->[$i] =~s/'/''/gs;
1005-
if ($row->[$i]) {
1010+
if ($row->[$i]ne'') {
10061011
$row->[$i] ="'$row->[$i]'";
10071012
}else {
10081013
$row->[$i] ='NULL';
@@ -1017,7 +1022,8 @@ print STDERR "Dumping table $table...\n" if ($self->{debug});
10171022
}
10181023
}
10191024
}else {
1020-
if (!$row->[$i]) {
1025+
$row->[$i] =~s/,/./;
1026+
if ($row->[$i]eq'') {
10211027
$row->[$i] ='NULL';
10221028
}
10231029
if ($self->{dbhdest}) {
@@ -1042,7 +1048,10 @@ print STDERR "Dumping table $table...\n" if ($self->{debug});
10421048
}
10431049
}
10441050
}else {
1045-
if (!$row->[$i]) {
1051+
if ($tt[$i] !~/(char|date|time|text)/) {
1052+
$row->[$i] =~s/,/./;
1053+
}
1054+
if ($row->[$i]eq'') {
10461055
$row->[$i] ='\N';
10471056
}
10481057
if ($self->{dbhdest}) {
@@ -1228,7 +1237,7 @@ sub _get_data
12281237
my$tmp ="SELECT";
12291238
formy$k (0 ..$#{$name}) {
12301239
if ($type->[$k] =~/(date|time)/) {
1231-
$str .="to_char($name->[$k], 'YYYY-MM-DD'),";
1240+
$str .="to_char($name->[$k], 'YYYY-MM-DD HH24:MI:SS'),";
12321241
}else {
12331242
$str .="$name->[$k],";
12341243
}
@@ -1290,8 +1299,8 @@ sub _sql_type
12901299
'VARCHAR2'=>'varchar',
12911300
'NVARCHAR2'=>'varchar',
12921301
# The DATE data type is used to store the date and time information.
1293-
# Pg typetimestamp should match all needs
1294-
'DATE'=>'timestamp',
1302+
# Pg typedatetime should match all needs
1303+
'DATE'=>'datetime',
12951304
# Type LONG is like VARCHAR2 but with up to 2Gb.
12961305
# PG type text should match all needs or if you want you could use blob
12971306
'LONG'=>'text',# Character data of variable length

‎contrib/oracle/TODO

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
Add possible call to perl function for each field value exported
2-
(data conversion on the fly before dump)
1+
The following need your contribution :
32

43
- Fix problem regarding table/constraint output order.
5-
6-
The following need your help :
7-
84
- SQL queries converter.
95
- PL/SQL code converter.
106

‎contrib/oracle/ora2pg.pl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ BEGIN
3030
user=>$dbuser,# Database user
3131
password=>$dbpwd,# Database password
3232
debug=> 1,# Verbose mode
33-
schema=>'APPS',# Extract only APPS schema
33+
schema=>'ALICIA7',# Extract only APPS schema
3434
type=>'TABLE',# Extract table
3535
#type => 'PACKAGE',# Extract PACKAGE information
3636
#type => 'DATA',# Extract data with output as INSERT statement
@@ -46,6 +46,7 @@ BEGIN
4646
#tables => [('TX_DATA')],# simple indexes
4747
#tables => [('NDW_BROWSER_ATTRIBUTES')],# view
4848
#tables => [('TRIP_DATA')],# Foreign key
49+
#tables => [('JO_TMP')],# Foreign key
4950
#showtableid => 1,# Display only table indice during extraction
5051
#min => 1,# Extract begin at indice 3
5152
#max => 10,# Extract ended at indice 5
@@ -56,15 +57,17 @@ BEGIN
5657
# Just export data of the following fields from table 's_txcot'
5758
#$schema->modify_struct('s_txcot','dossier', 'rub', 'datapp');
5859

59-
# Function to use for extraction when type option is set to DATA or COPY
60+
#### Function to use for extraction when type option is set to DATA or COPY
61+
6062
# Send exported data to a PostgreSQL database
6163
#$schema->send_to_pgdb('dbi:Pg:dbname=template1;host=localhost;port=5432','test','test');
6264

6365
# Output the data extracted from Oracle DB to a file or to STDOUT if no argument.
6466
# If you set the send_to_pgdb() method the output is given to PG database. See above
6567
#$schema->export_data("output.sql");
6668

67-
# Function to use ifor extraction with other type
69+
#### Function to use for extraction of other type
70+
6871
# Create the POSTGRESQL representation of all objects in the database
6972
$schema->export_schema("output.sql");
7073

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp