Skip to content

Commit eea4786

Browse files
Vladislav Moiseevfljdin
authored andcommitted
Added sforce_ssl flag for Kettle
1 parent 5739ce0 commit eea4786

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

sqlserver2pgsql.pl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
our $parallelism_out;
5454
our $sort_size;
5555
our $use_pk_if_possible;
56+
our $sforce_ssl;
5657
our $pforce_ssl;
5758
our $stringtype_unspecified;
5859
our $skip_citext_length_check;
@@ -114,6 +115,7 @@ sub parse_conf_file
114115
'sort size' => 'sort_size',
115116
'use pk if possible' => 'use_pk_if_possible',
116117
'ignore errors' => 'ignore_errors',
118+
'sql server force ssl' => 'sforce_ssl',
117119
'postgresql force ssl' => 'pforce_ssl',
118120
'stringtype unspecified' => 'stringtype_unspecified',
119121
'skip citext length check' => 'skip_citext_length_check',
@@ -168,6 +170,7 @@ sub set_default_conf_values
168170
$ignore_errors=0 unless (defined ($ignore_errors));
169171
$pp=5432 unless (defined ($pp)); # Default port for PostgreSQL
170172
$sp=1433 unless (defined ($sp)); # Default port for SQL-Server
173+
$sforce_ssl=0 unless (defined ($sforce_ssl));
171174
$pforce_ssl=0 unless (defined ($pforce_ssl));
172175
$stringtype_unspecified=0 unless (defined ($stringtype_unspecified));
173176
$skip_citext_length_check=0 unless (defined ($skip_citext_length_check));
@@ -894,6 +897,8 @@ sub usage
894897
parallelism level for the kettle job (input, SQL Server). Default 1.
895898
-po PARALLELISM_OUT
896899
parallelism level for the kettle job (output, PostgreSQL). Default 8.
900+
-sforce_ssl
901+
force a SSL session to SQL Server
897902
-pforce_ssl
898903
force a SSL session to PostgreSQL
899904
-stringtype_unspecified
@@ -1029,6 +1034,14 @@ sub generate_kettle
10291034
$newtemplate =~ s/<use_batch>Y<\/use_batch>/<use_batch>N<\/use_batch>/g; # Cannot use batch mode with ignore errors
10301035
}
10311036

1037+
if ($sforce_ssl)
1038+
{
1039+
$newtemplate =~ s/__sforce_ssl__/<attribute><code>EXTRA_OPTION_MSSQL.ssl<\/code><attribute>require<\/attribute><\/attribute>/g;
1040+
}
1041+
else
1042+
{
1043+
$newtemplate =~ s/__sforce_ssl__//g;
1044+
}
10321045
if ($pforce_ssl)
10331046
{
10341047
$newtemplate =~ s/__pforce_ssl__/<attribute><code>EXTRA_OPTION_POSTGRESQL.ssl<\/code><attribute>true<\/attribute><\/attribute>\n<attribute><code>EXTRA_OPTION_POSTGRESQL.sslfactory<\/code><attribute>org.postgresql.ssl.NonValidatingFactory<\/attribute><\/attribute>/g;
@@ -1066,6 +1079,14 @@ sub generate_kettle
10661079
$newincrementaltemplate =~ s/__PARALLELISM_OUT__/$parallelism_out/g;
10671080
$newincrementaltemplate =~ s/__sort_size__/$sort_size/g;
10681081

1082+
if ($sforce_ssl)
1083+
{
1084+
$newincrementaltemplate =~ s/__sforce_ssl__/<attribute><code>EXTRA_OPTION_MSSQL.ssl<\/code><attribute>require<\/attribute><\/attribute>/g;
1085+
}
1086+
else
1087+
{
1088+
$newincrementaltemplate =~ s/__sforce_ssl__//g;
1089+
}
10691090
if ($pforce_ssl)
10701091
{
10711092
$newincrementaltemplate =~ s/__pforce_ssl__/<attribute><code>EXTRA_OPTION_POSTGRESQL.ssl<\/code><attribute>true<\/attribute><\/attribute>\n<attribute><code>EXTRA_OPTION_POSTGRESQL.sslfactory<\/code><attribute>org.postgresql.ssl.NonValidatingFactory<\/attribute><\/attribute>/g;
@@ -3283,6 +3304,7 @@ sub resolve_name_conflicts
32833304
"sort_size=i" => \$sort_size,
32843305
"use_pk_if_possible=s" => \$use_pk_if_possible,
32853306
"ignore_errors" => \$ignore_errors,
3307+
"sforce_ssl" => \$sforce_ssl,
32863308
"pforce_ssl" => \$pforce_ssl,
32873309
"stringtype_unspecified" => \$stringtype_unspecified,
32883310
"skip_citext_length_check" => \$skip_citext_length_check,
@@ -3420,6 +3442,7 @@ BEGIN
34203442
<data_tablespace/>
34213443
<index_tablespace/>
34223444
<attributes>
3445+
__sforce_ssl__
34233446
<attribute><code>EXTRA_OPTION_MSSQL.instance</code><attribute>__sqlserver_instance__</attribute></attribute>
34243447
<attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
34253448
<attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
@@ -3782,6 +3805,7 @@ BEGIN
37823805
<data_tablespace/>
37833806
<index_tablespace/>
37843807
<attributes>
3808+
__sforce_ssl__
37853809
<attribute><code>EXTRA_OPTION_MSSQL.instance</code><attribute>__sqlserver_instance__</attribute></attribute>
37863810
<attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
37873811
<attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
@@ -4351,6 +4375,7 @@ BEGIN
43514375
<data_tablespace/>
43524376
<index_tablespace/>
43534377
<attributes>
4378+
__sforce_ssl__
43544379
<attribute><code>EXTRA_OPTION_MSSQL.instance</code><attribute>__sqlserver_instance__</attribute></attribute>
43554380
<attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
43564381
<attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
@@ -4781,6 +4806,7 @@ BEGIN
47814806
<data_tablespace/>
47824807
<index_tablespace/>
47834808
<attributes>
4809+
__sforce_ssl__
47844810
<attribute><code>EXTRA_OPTION_MSSQL.instance</code><attribute>__sqlserver_instance__</attribute></attribute>
47854811
<attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
47864812
<attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>

0 commit comments

Comments
 (0)