• R/O
  • HTTP
  • SSH
  • HTTPS

rapideact: Commit


Commit MetaInfo

Revision05b9fd2f73e6bb64597fa61a5ef2479612529967 (tree)
Time2017-05-21 08:29:28
Authorkuboryu <kuboryu@yaho...>
Commiterkuboryu

Log Message

20170521

Change Summary

Incremental Difference

--- a/com/rapide_act/CmnProps.java
+++ b/com/rapide_act/CmnProps.java
@@ -41,6 +41,7 @@ public class CmnProps{
4141 protected static final String [] DB_SQL_QUOTEDE = {"\"", "]", "`", "\"", "\"", "\""};
4242 protected static final String [] SQL_TERMINATOR = {";", System.getProperty("line.separator") + "GO", ";", ";", ";", ";"};
4343 protected static final String [] SQL_PREFIX = {"@", ":r ", "", "", "", ""};
44+ protected static final String [] SQL_COMMENT_MARK = {"--", "--", "--", "--", "--", "--"};
4445 protected static final int MASK_PTN_ALL = 0;
4546 protected static final int MASK_PTN_ALT = 1;
4647 protected static final int MASK_PTN_EDGE = 2;
@@ -107,6 +108,25 @@ public class CmnProps{
107108 protected static final int DROP_SEQUENCE = 16;
108109 protected static final int CREATE_FK = 17;
109110 protected static final int DROP_FK = 18;
111+ protected static final int TYPE_TABLE = 0;
112+ protected static final int TYPE_INDEX = 1;
113+ protected static final int TYPE_VIEW = 2;
114+ protected static final int TYPE_PROCEDURE = 3;
115+ protected static final int TYPE_SEQ = 4;
116+ protected static final int TYPE_SYNONYM = 5;
117+ protected static final int TYPE_OBJ = 6;
118+ protected static final int TYPE_FK = 7;
119+ protected static final String [] FILE_NAME = {
120+ "TABLEDEF",
121+ "INDEXDEF",
122+ "VIEWDEF",
123+ "PROCDEF",
124+ "SEQDEF",
125+ "SYNMDEF",
126+ "OBJDEF",
127+ "FKDEF"
128+ };
129+ protected static final String [] DROP_OPTION = {" CASCADE CONSTRAINT PURGE", "", "", "", "", ""};
110130
111131 protected static final String [] SQL_FILE_NAME = {
112132 "createTable.sql",
@@ -316,6 +336,365 @@ public class CmnProps{
316336 + " a.table_name, "
317337 + " b.column_id"
318338 };
339+ protected static final String [][] meta_sql = {
340+ { //ORACLE
341+ "select "
342+ + "a.table_name as table_name,"
343+ + "replace(replace(b.comments, chr(13), ''), chr(10), '') as table_comments,"
344+ + "c.column_name as column_name, "
345+ + "replace(replace(d.comments, chr(13), ''), chr(10), '') as column_comments, "
346+ + "decode(c.data_type, 'TIMESTAMP(6)', 'TIMESTAMP',c.data_type) as data_type, "
347+ + "c.data_length as data_length,"
348+ + "c.data_precision as data_precision,"
349+ + "c.data_scale as data_scale,"
350+ + "decode(c.nullable, 'N', '○', null) as nullable,"
351+ + "c.data_default as data_default "
352+ + "from user_tables a "
353+ + "inner join user_tab_comments b "
354+ + "on a.table_name = b.table_name "
355+ + "inner join user_tab_columns c "
356+ + "on a.table_name = c.table_name "
357+ + "inner join user_col_comments d "
358+ + "on c.table_name = d.table_name "
359+ + " and c.column_name = d.column_name "
360+ + "order by a.table_name,c.column_id",
361+ "select "
362+ + " a.table_name,"
363+ + " a.index_name,"
364+ + " a.index_type,"
365+ + " c.constraint_type,"
366+ + " b.column_name,"
367+ + " b.column_position "
368+ + " from"
369+ + " user_indexes a,"
370+ + " user_ind_columns b,"
371+ + " user_constraints c "
372+ + " where"
373+ + " a.table_name = b.table_name and"
374+ + " a.index_name = b.index_name and"
375+ + " a.table_name = c.table_name(+) and"
376+ + " a.index_name = c.constraint_name(+) "
377+ + " order by"
378+ + " a.table_name,"
379+ + " a.index_name,"
380+ + " b.column_position",
381+ "select "
382+ + " a.view_name, "
383+ + " replace(replace(c.comments, chr(13), ''), chr(10), '') as comments "
384+ + " from"
385+ + " user_views a, "
386+ + " user_tab_comments c "
387+ + " where"
388+ + " a.view_name = c.table_name(+) "
389+ + " order by"
390+ + " a.view_name",
391+ "select "
392+ + " object_name, "
393+ + " object_type "
394+ + "from"
395+ + " user_objects"
396+ + " where object_type in('PACKAGE BODY','PROCEDURE','FUNCTION','TRIGGER','TYPE')"
397+ + " group by object_name,object_type"
398+ + " order by object_name,object_type",
399+ "select "
400+ + " sequence_name,"
401+ + " to_char(min_value) as min_value,"
402+ + " to_char(max_value) as max_value,"
403+ + " to_char(increment_by) as increment_by,"
404+ + " cycle_flag,"
405+ + " order_flag,"
406+ + " to_char(cache_size) as cache_size,"
407+ + " to_char(last_number) as last_number "
408+ + " from user_sequences "
409+ + " order by sequence_name",
410+ "select "
411+ + " synonym_name,"
412+ + " table_owner,"
413+ + " table_name,"
414+ + " db_link "
415+ + "from user_synonyms "
416+ + "order by synonym_name,table_owner,table_name",
417+ "select "
418+ + " a.table_name,"
419+ + " a.object_name,"
420+ + " a.object_type,"
421+ + " a.pct_free,"
422+ + " a.pct_used,"
423+ + " a.ini_trans,"
424+ + " a.freelists,"
425+ + " a.freelist_groups,"
426+ + " a.buffer_pool,"
427+ + " a.tablespace_name, "
428+ + " a.logging, "
429+ + " b.bytes "
430+ + "from "
431+ + "(select "
432+ + " table_name,"
433+ + " table_name as object_name,"
434+ + " 'TABLE' as object_type,"
435+ + " pct_free,"
436+ + " pct_used,"
437+ + " ini_trans,"
438+ + " freelists,"
439+ + " freelist_groups,"
440+ + " buffer_pool,"
441+ + " tablespace_name, "
442+ + " logging "
443+ + "from "
444+ + " user_tables "
445+ + " union select "
446+ + " table_name,"
447+ + " index_name as object_name,"
448+ + " 'INDEX' as object_type,"
449+ + " pct_free,"
450+ + " null as pct_used,"
451+ + " ini_trans,"
452+ + " freelists,"
453+ + " freelist_groups,"
454+ + " buffer_pool,"
455+ + " tablespace_name, "
456+ + " logging "
457+ + " from "
458+ + " user_indexes "
459+ + ") a, "
460+ + "(select "
461+ + " segment_name,"
462+ + " segment_type,"
463+ + " bytes "
464+ + " from "
465+ + " user_segments "
466+ + ") b "
467+ + " where a.object_name = b.segment_name "
468+ + " and a.object_type = b.segment_type "
469+ + " order by"
470+ + " a.table_name,"
471+ + " a.object_name",
472+ "select distinct "
473+ + " a.table_name as table_name, "
474+ + " a.constraint_name as constraint_name, "
475+ + " b.column_name as column_name, "
476+ + " b.position as position,"
477+ + " c.table_name as r_table_name, "
478+ + " d.column_name as r_column_name, "
479+ + " d.position as r_position "
480+ + " from "
481+ + " user_constraints a, "
482+ + " user_cons_columns b,"
483+ + " user_constraints c, "
484+ + " user_cons_columns d "
485+ + " where "
486+ + " a.constraint_type = 'R'"
487+ + " and a.owner = b.owner"
488+ + " and a.table_name = b.table_name"
489+ + " and a.constraint_name = b.constraint_name"
490+ + " and c.constraint_type in('P','U')"
491+ + " and c.owner = b.owner"
492+ + " and c.table_name = d.table_name"
493+ + " and c.constraint_name = d.constraint_name"
494+ + " and a.r_owner = c.owner"
495+ + " and a.r_constraint_name = c.constraint_name"
496+ + " order by"
497+ + " a.table_name,a.constraint_name,b.position,d.position"
498+ },
499+ { //SQLSERVER
500+ "select "
501+ + "a.name as table_name, "
502+ + "replace(replace(cast(b.value as varchar(4000)), char(13), ''), char(10), '') as table_comments, "
503+ + "c.name as column_name, "
504+ + "replace(replace(cast(d.value as varchar(4000)), char(13), ''), char(10), '') as column_comments, "
505+ + "e.name as data_type, "
506+ + "c.max_length as data_length, "
507+ + "c.precision as data_precision, "
508+ + "c.scale as data_scale, "
509+ + "case c.is_nullable"
510+ + " when '0' then '〇'"
511+ + " else null "
512+ + "end as nullable,"
513+ + "g.definition as data_default "
514+ + "from "
515+ + "sys.tables as a "
516+ + "left outer join sys.extended_properties as b "
517+ + "on a.object_id = b.major_id and b.minor_id = 0 "
518+ + "inner join sys.columns as c "
519+ + "on a.object_id = c.object_id "
520+ + "left outer join sys.extended_properties as d "
521+ + "on a.object_id = d.major_id and c.column_id = d.minor_id "
522+ + "inner join sys.types as e "
523+ + "on c.system_type_id = e.system_type_id and c.user_type_id = e.user_type_id "
524+ + "left outer join sys.sysconstraints f "
525+ + "on c.object_id = f.id "
526+ + "and c.column_id = f.colid "
527+ + "and (f.status & 2069) = 2069 "
528+ + "left outer join sys.default_constraints g "
529+ + "on f.constid = g.object_id "
530+ + "and a.schema_id = g.schema_id "
531+ + "order by a.name,c.column_id ",
532+ "select "
533+ + "d.name as table_name, "
534+ + "a.name as index_name, "
535+ + "a.type as index_type, "
536+ + "case a.is_unique "
537+ + " when 1 then "
538+ + " case a.is_primary_key "
539+ + " when 1 then 'P' "
540+ + " else "
541+ + " case a.is_unique_constraint "
542+ + " when 1 then 'U' "
543+ + " else '' "
544+ + " end "
545+ + " end "
546+ + " else '' "
547+ + "end as constraint_type, "
548+ + "c.name as column_name, "
549+ + "b.key_ordinal as column_position "
550+ + "from "
551+ + " sys.indexes as a "
552+ + " inner join sys.index_columns as b "
553+ + " on a.object_id = b.object_id and a.index_id = b.index_id "
554+ + " inner join sys.columns as c "
555+ + " on c.column_id = b.column_id "
556+ + " and c.object_id = b.object_id "
557+ + " inner join sys.objects as d "
558+ + " on a.object_id = d.object_id and d.type = 'U' "
559+ + "order by d.name, a.name,b.key_ordinal",
560+ "select "
561+ + " a.name as view_name, "
562+ + " replace(replace(cast(b.value as varchar(4000)), char(13), ''), char(10), '') as comments "
563+ + "from "
564+ + " sys.views a "
565+ + " left outer join sys.extended_properties as b "
566+ + " on a.object_id = b.major_id and b.minor_id = 0 "
567+ + "order by "
568+ + " a.name",
569+ "select "
570+ + " name as object_name, 'PROCEDURE' as object_type from sys.procedures"
571+ + " union select "
572+ + " name as object_name, 'FUNCTION' as object_type from sys.objects where type in('FN', 'FS', 'FT', 'IF', 'TF') "
573+ + " union select "
574+ + " name as object_name, 'TRIGGER' as object_type from sys.triggers "
575+ + " order by object_name,object_type ",
576+ "select "
577+ + " name as sequence_name,"
578+ + " cast(minimum_value as varchar(20)) as min_value,"
579+ + " cast(maximum_value as varchar(20)) as max_value,"
580+ + " cast(increment as varchar(20)) as increment_by,"
581+ + " is_cycling as cycle_flag,"
582+ + " is_cached as order_flag,"
583+ + " cast(cache_size as varchar(20)) as cache_size,"
584+ + " cast(start_value as varchar(20)) as last_number "
585+ + " from sys.sequences "
586+ + " order by name",
587+ "select "
588+ + " a.name as synonym_name,"
589+ + " b.name as table_owner,"
590+ + " base_object_name as table_name,"
591+ + " '' as db_link "
592+ + "from sys.synonyms a "
593+ + " inner join sys.schemas as b "
594+ + " on a.schema_id = b.schema_id "
595+ + "order by synonym_name,table_owner,table_name",
596+ "select "
597+ + " c.name as table_name, "
598+ + " b.index_id, "
599+ + " d.name as index_name , "
600+ + " a.type_desc as allocation_type, "
601+ + " a.data_pages, "
602+ + " partition_number "
603+ + "from "
604+ + " sys.allocation_units as a "
605+ + " inner join sys.partitions as b "
606+ + " on a.container_id = b.partition_id "
607+ + " inner join sys.objects as c "
608+ + " on b.object_id = c.object_id and c.type = 'U' "
609+ + " inner join sys.indexes as d "
610+ + " on b.index_id = d.index_id and d.object_id = b.object_id "
611+ + "order by c.name, b.index_id",
612+ "select distinct "
613+ + " c.name as table_name, "
614+ + " a.name as constraint_name, "
615+ + " d.name as column_name, "
616+ + " b.constraint_column_id as position, "
617+ + " e.name as r_table_name, "
618+ + " f.name as r_column_name ,"
619+ + " f.column_id as r_position "
620+ + "from sys.foreign_keys as a "
621+ + " inner join sys.foreign_key_columns as b "
622+ + " on a.object_id = b.constraint_object_id "
623+ + " inner join sys.tables as c "
624+ + " on b.parent_object_id = c.object_id "
625+ + " inner join sys.columns as d "
626+ + " on b.parent_object_id = d.object_id and "
627+ + " b.parent_column_id = d.column_id "
628+ + " inner join sys.tables as e "
629+ + " on b.referenced_object_id = e.object_id "
630+ + " inner join sys.columns as f "
631+ + " on b.referenced_object_id = f.object_id and "
632+ + " b.referenced_column_id = f.column_id "
633+ + " inner join sys.key_constraints as g "
634+ + " on a.referenced_object_id = g.parent_object_id "
635+ + "order by table_name,constraint_name, position"
636+ }
637+ };
638+ protected static String sql_view_text[] = {
639+ "select text from user_views where view_name = ?",
640+ "select c.definition "
641+ + "from sys.views a "
642+ + "inner join sys.objects b "
643+ + "on b.object_id = a.object_id "
644+ + "inner join sys.sql_modules c "
645+ + "on c.object_id = b.object_id "
646+ + "where a.name = ?"
647+ };
648+ protected static String sql_view_column_and_comment[] = {
649+ "select "
650+ + " b.column_name,"
651+ + " replace(replace(d.comments, chr(13), ''), chr(10), '') as comments "
652+ + " from"
653+ + " user_tab_columns b,"
654+ + " user_col_comments d "
655+ + " where"
656+ + " b.table_name = ? and"
657+ + " b.table_name = d.table_name(+) and"
658+ + " b.column_name = d.column_name(+) "
659+ + " order by"
660+ + " b.column_id",
661+ " select "
662+ + " b.name as column_name, "
663+ + " '' as comments "
664+ + " from "
665+ + " sys.objects a "
666+ + " inner join sys.columns b on a.object_id = b.object_id and a.name = ? "
667+ + " inner join sys.types c on b.system_type_id = c.system_type_id "
668+ + " where a.type = 'V' "
669+ + " and c.user_type_id <> 256 "
670+ + " order by b.column_id"
671+ };
672+ protected static String sql_proc[] = {
673+ "select text from user_source where type = ? and name = ? order by line",
674+ "select d.definition "
675+ + "from "
676+ + " (select a.name,'PROCEDURE' as type,c.definition "
677+ + "from sys.procedures a "
678+ + "inner join sys.objects b "
679+ + "on b.object_id = a.object_id "
680+ + "inner join sys.sql_modules c "
681+ + "on c.object_id = b.object_id "
682+ + "union select "
683+ + " a.name,'FUNCTION' as type,c.definition "
684+ + "from sys.objects a "
685+ + "inner join sys.objects b "
686+ + "on b.object_id = a.object_id "
687+ + "inner join sys.sql_modules c "
688+ + "on c.object_id = b.object_id and a.type in('FN', 'FS', 'FT', 'IF', 'TF') "
689+ + "union select "
690+ + "a.name,'TRIGGER' as type,c.definition "
691+ + "from sys.triggers a "
692+ + "inner join sys.objects b "
693+ + "on b.object_id = a.object_id "
694+ + "inner join sys.sql_modules c "
695+ + "on c.object_id = b.object_id) d "
696+ + "where d.type = ? and d.name = ?"
697+ };
319698
320699 protected String user = null;
321700 protected String pass = null;
--- a/com/rapide_act/RapideMetaUnloader.java
+++ b/com/rapide_act/RapideMetaUnloader.java
@@ -28,396 +28,7 @@ import java.sql.Clob;
2828
2929 public class RapideMetaUnloader{
3030
31- private static final int DB_TYPE_ORACLE = 0;
32- private static final int DB_TYPE_SQLSERVER = 1;
33- private static final int DB_TYPE_MYSQL = 2;
34- private static final int DB_TYPE_DB2 = 3;
35- private static final int DB_TYPE_POSTGRESQL = 4;
36- private static final int DB_TYPE_HIRDB = 5;
37- private static final int DB_TYPE_UNKNOWN = -1;
38- private static final int TYPE_TABLE = 0;
39- private static final int TYPE_INDEX = 1;
40- private static final int TYPE_VIEW = 2;
41- private static final int TYPE_PROCEDURE = 3;
42- private static final int TYPE_SEQ = 4;
43- private static final int TYPE_SYNONYM = 5;
44- private static final int TYPE_OBJ = 6;
45- private static final int TYPE_FK = 7;
46- private static final String [] FILE_NAME = {
47- "TABLEDEF",
48- "INDEXDEF",
49- "VIEWDEF",
50- "PROCDEF",
51- "SEQDEF",
52- "SYNMDEF",
53- "OBJDEF",
54- "FKDEF"
55- };
56- private static final String lineSeparator = System.getProperty("line.separator");
57- protected static final String [] DB_SQL_QUOTED_S = {"\"", "[", "`", "\"", "\"", "\""};
58- protected static final String [] DB_SQL_QUOTED_E = {"\"", "]", "`", "\"", "\"", "\""};
59- private static final String [] DROP_OPTION = {" CASCADE CONSTRAINT PURGE", "", "", "", "", ""};
60-// private static final String [] cp.SQL_TERMINATOR = {";", lineSeparator + "GO", ";", ";", ";", ";"};
61-// private static final String [] cp.SQL_PREFIX = {"@", ":r ", "", "", "", ""};
62- private static final String [][] sql = {
63- { //ORACLE
64- "select "
65- + "a.table_name as table_name,"
66- + "replace(replace(b.comments, chr(13), ''), chr(10), '') as table_comments,"
67- + "c.column_name as column_name, "
68- + "replace(replace(d.comments, chr(13), ''), chr(10), '') as column_comments, "
69- + "decode(c.data_type, 'TIMESTAMP(6)', 'TIMESTAMP',c.data_type) as data_type, "
70- + "c.data_length as data_length,"
71- + "c.data_precision as data_precision,"
72- + "c.data_scale as data_scale,"
73- + "decode(c.nullable, 'N', '○', null) as nullable,"
74- + "c.data_default as data_default "
75- + "from user_tables a "
76- + "inner join user_tab_comments b "
77- + "on a.table_name = b.table_name "
78- + "inner join user_tab_columns c "
79- + "on a.table_name = c.table_name "
80- + "inner join user_col_comments d "
81- + "on c.table_name = d.table_name "
82- + " and c.column_name = d.column_name "
83- + "order by a.table_name,c.column_id",
84- "select "
85- + " a.table_name,"
86- + " a.index_name,"
87- + " a.index_type,"
88- + " c.constraint_type,"
89- + " b.column_name,"
90- + " b.column_position "
91- + " from"
92- + " user_indexes a,"
93- + " user_ind_columns b,"
94- + " user_constraints c "
95- + " where"
96- + " a.table_name = b.table_name and"
97- + " a.index_name = b.index_name and"
98- + " a.table_name = c.table_name(+) and"
99- + " a.index_name = c.constraint_name(+) "
100- + " order by"
101- + " a.table_name,"
102- + " a.index_name,"
103- + " b.column_position",
104- "select "
105- + " a.view_name, "
106- + " replace(replace(c.comments, chr(13), ''), chr(10), '') as comments "
107- + " from"
108- + " user_views a, "
109- + " user_tab_comments c "
110- + " where"
111- + " a.view_name = c.table_name(+) "
112- + " order by"
113- + " a.view_name",
114- "select "
115- + " object_name, "
116- + " object_type "
117- + "from"
118- + " user_objects"
119- + " where object_type in('PACKAGE BODY','PROCEDURE','FUNCTION','TRIGGER','TYPE')"
120- + " group by object_name,object_type"
121- + " order by object_name,object_type",
122- "select "
123- + " sequence_name,"
124- + " to_char(min_value) as min_value,"
125- + " to_char(max_value) as max_value,"
126- + " to_char(increment_by) as increment_by,"
127- + " cycle_flag,"
128- + " order_flag,"
129- + " to_char(cache_size) as cache_size,"
130- + " to_char(last_number) as last_number "
131- + " from user_sequences "
132- + " order by sequence_name",
133- "select "
134- + " synonym_name,"
135- + " table_owner,"
136- + " table_name,"
137- + " db_link "
138- + "from user_synonyms "
139- + "order by synonym_name,table_owner,table_name",
140- "select "
141- + " a.table_name,"
142- + " a.object_name,"
143- + " a.object_type,"
144- + " a.pct_free,"
145- + " a.pct_used,"
146- + " a.ini_trans,"
147- + " a.freelists,"
148- + " a.freelist_groups,"
149- + " a.buffer_pool,"
150- + " a.tablespace_name, "
151- + " a.logging, "
152- + " b.bytes "
153- + "from "
154- + "(select "
155- + " table_name,"
156- + " table_name as object_name,"
157- + " 'TABLE' as object_type,"
158- + " pct_free,"
159- + " pct_used,"
160- + " ini_trans,"
161- + " freelists,"
162- + " freelist_groups,"
163- + " buffer_pool,"
164- + " tablespace_name, "
165- + " logging "
166- + "from "
167- + " user_tables "
168- + " union select "
169- + " table_name,"
170- + " index_name as object_name,"
171- + " 'INDEX' as object_type,"
172- + " pct_free,"
173- + " null as pct_used,"
174- + " ini_trans,"
175- + " freelists,"
176- + " freelist_groups,"
177- + " buffer_pool,"
178- + " tablespace_name, "
179- + " logging "
180- + " from "
181- + " user_indexes "
182- + ") a, "
183- + "(select "
184- + " segment_name,"
185- + " segment_type,"
186- + " bytes "
187- + " from "
188- + " user_segments "
189- + ") b "
190- + " where a.object_name = b.segment_name "
191- + " and a.object_type = b.segment_type "
192- + " order by"
193- + " a.table_name,"
194- + " a.object_name",
195- "select distinct "
196- + " a.table_name as table_name, "
197- + " a.constraint_name as constraint_name, "
198- + " b.column_name as column_name, "
199- + " b.position as position,"
200- + " c.table_name as r_table_name, "
201- + " d.column_name as r_column_name, "
202- + " d.position as r_position "
203- + " from "
204- + " user_constraints a, "
205- + " user_cons_columns b,"
206- + " user_constraints c, "
207- + " user_cons_columns d "
208- + " where "
209- + " a.constraint_type = 'R'"
210- + " and a.owner = b.owner"
211- + " and a.table_name = b.table_name"
212- + " and a.constraint_name = b.constraint_name"
213- + " and c.constraint_type in('P','U')"
214- + " and c.owner = b.owner"
215- + " and c.table_name = d.table_name"
216- + " and c.constraint_name = d.constraint_name"
217- + " and a.r_owner = c.owner"
218- + " and a.r_constraint_name = c.constraint_name"
219- + " order by"
220- + " a.table_name,a.constraint_name,b.position,d.position"
221- },
222- { //SQL SERVER
223- "select "
224- + "a.name as table_name, "
225- + "replace(replace(cast(b.value as varchar(4000)), char(13), ''), char(10), '') as table_comments, "
226- + "c.name as column_name, "
227- + "replace(replace(cast(d.value as varchar(4000)), char(13), ''), char(10), '') as column_comments, "
228- + "e.name as data_type, "
229- + "c.max_length as data_length, "
230- + "c.precision as data_precision, "
231- + "c.scale as data_scale, "
232- + "case c.is_nullable"
233- + " when '0' then '〇'"
234- + " else null "
235- + "end as nullable,"
236- + "g.definition as data_default "
237- + "from "
238- + "sys.tables as a "
239- + "left outer join sys.extended_properties as b "
240- + "on a.object_id = b.major_id and b.minor_id = 0 "
241- + "inner join sys.columns as c "
242- + "on a.object_id = c.object_id "
243- + "left outer join sys.extended_properties as d "
244- + "on a.object_id = d.major_id and c.column_id = d.minor_id "
245- + "inner join sys.types as e "
246- + "on c.system_type_id = e.system_type_id and c.user_type_id = e.user_type_id "
247- + "left outer join sys.sysconstraints f "
248- + "on c.object_id = f.id "
249- + "and c.column_id = f.colid "
250- + "and (f.status & 2069) = 2069 "
251- + "left outer join sys.default_constraints g "
252- + "on f.constid = g.object_id "
253- + "and a.schema_id = g.schema_id "
254- + "order by a.name,c.column_id ",
255- "select "
256- + "d.name as table_name, "
257- + "a.name as index_name, "
258- + "a.type as index_type, "
259- + "case a.is_unique "
260- + " when 1 then "
261- + " case a.is_primary_key "
262- + " when 1 then 'P' "
263- + " else "
264- + " case a.is_unique_constraint "
265- + " when 1 then 'U' "
266- + " else '' "
267- + " end "
268- + " end "
269- + " else '' "
270- + "end as constraint_type, "
271- + "c.name as column_name, "
272- + "b.key_ordinal as column_position "
273- + "from "
274- + " sys.indexes as a "
275- + " inner join sys.index_columns as b "
276- + " on a.object_id = b.object_id and a.index_id = b.index_id "
277- + " inner join sys.columns as c "
278- + " on c.column_id = b.column_id "
279- + " and c.object_id = b.object_id "
280- + " inner join sys.objects as d "
281- + " on a.object_id = d.object_id and d.type = 'U' "
282- + "order by d.name, a.name,b.key_ordinal",
283- "select "
284- + " a.name as view_name, "
285- + " replace(replace(cast(b.value as varchar(4000)), char(13), ''), char(10), '') as comments "
286- + "from "
287- + " sys.views a "
288- + " left outer join sys.extended_properties as b "
289- + " on a.object_id = b.major_id and b.minor_id = 0 "
290- + "order by "
291- + " a.name",
292- "select "
293- + " name as object_name, 'PROCEDURE' as object_type from sys.procedures"
294- + " union select "
295- + " name as object_name, 'FUNCTION' as object_type from sys.objects where type in('FN', 'FS', 'FT', 'IF', 'TF') "
296- + " union select "
297- + " name as object_name, 'TRIGGER' as object_type from sys.triggers "
298- + " order by object_name,object_type ",
299- "select "
300- + " name as sequence_name,"
301- + " cast(minimum_value as varchar(20)) as min_value,"
302- + " cast(maximum_value as varchar(20)) as max_value,"
303- + " cast(increment as varchar(20)) as increment_by,"
304- + " is_cycling as cycle_flag,"
305- + " is_cached as order_flag,"
306- + " cast(cache_size as varchar(20)) as cache_size,"
307- + " cast(start_value as varchar(20)) as last_number "
308- + " from sys.sequences "
309- + " order by name",
310- "select "
311- + " a.name as synonym_name,"
312- + " b.name as table_owner,"
313- + " base_object_name as table_name,"
314- + " '' as db_link "
315- + "from sys.synonyms a "
316- + " inner join sys.schemas as b "
317- + " on a.schema_id = b.schema_id "
318- + "order by synonym_name,table_owner,table_name",
319- "select "
320- + " c.name as table_name, "
321- + " b.index_id, "
322- + " d.name as index_name , "
323- + " a.type_desc as allocation_type, "
324- + " a.data_pages, "
325- + " partition_number "
326- + "from "
327- + " sys.allocation_units as a "
328- + " inner join sys.partitions as b "
329- + " on a.container_id = b.partition_id "
330- + " inner join sys.objects as c "
331- + " on b.object_id = c.object_id and c.type = 'U' "
332- + " inner join sys.indexes as d "
333- + " on b.index_id = d.index_id and d.object_id = b.object_id "
334- + "order by c.name, b.index_id",
335- "select distinct "
336- + " c.name as table_name, "
337- + " a.name as constraint_name, "
338- + " d.name as column_name, "
339- + " b.constraint_column_id as position, "
340- + " e.name as r_table_name, "
341- + " f.name as r_column_name ,"
342- + " f.column_id as r_position "
343- + "from sys.foreign_keys as a "
344- + " inner join sys.foreign_key_columns as b "
345- + " on a.object_id = b.constraint_object_id "
346- + " inner join sys.tables as c "
347- + " on b.parent_object_id = c.object_id "
348- + " inner join sys.columns as d "
349- + " on b.parent_object_id = d.object_id and "
350- + " b.parent_column_id = d.column_id "
351- + " inner join sys.tables as e "
352- + " on b.referenced_object_id = e.object_id "
353- + " inner join sys.columns as f "
354- + " on b.referenced_object_id = f.object_id and "
355- + " b.referenced_column_id = f.column_id "
356- + " inner join sys.key_constraints as g "
357- + " on a.referenced_object_id = g.parent_object_id "
358- + "order by table_name,constraint_name, position"
359- }
360- };
361- private static String sql_view_text[] = {
362- "select text from user_views where view_name = ?",
363- "select c.definition "
364- + "from sys.views a "
365- + "inner join sys.objects b "
366- + "on b.object_id = a.object_id "
367- + "inner join sys.sql_modules c "
368- + "on c.object_id = b.object_id "
369- + "where a.name = ?"
370- };
371- private static String sql_view_column_and_comment[] = {
372- "select "
373- + " b.column_name,"
374- + " replace(replace(d.comments, chr(13), ''), chr(10), '') as comments "
375- + " from"
376- + " user_tab_columns b,"
377- + " user_col_comments d "
378- + " where"
379- + " b.table_name = ? and"
380- + " b.table_name = d.table_name(+) and"
381- + " b.column_name = d.column_name(+) "
382- + " order by"
383- + " b.column_id",
384- " select "
385- + " b.name as column_name, "
386- + " '' as comments "
387- + " from "
388- + " sys.objects a "
389- + " inner join sys.columns b on a.object_id = b.object_id and a.name = ? "
390- + " inner join sys.types c on b.system_type_id = c.system_type_id "
391- + " where a.type = 'V' "
392- + " and c.user_type_id <> 256 "
393- + " order by b.column_id"
394- };
395- private static String sql_proc[] = {
396- "select text from user_source where type = ? and name = ? order by line",
397- "select d.definition "
398- + "from "
399- + " (select a.name,'PROCEDURE' as type,c.definition "
400- + "from sys.procedures a "
401- + "inner join sys.objects b "
402- + "on b.object_id = a.object_id "
403- + "inner join sys.sql_modules c "
404- + "on c.object_id = b.object_id "
405- + "union select "
406- + " a.name,'FUNCTION' as type,c.definition "
407- + "from sys.objects a "
408- + "inner join sys.objects b "
409- + "on b.object_id = a.object_id "
410- + "inner join sys.sql_modules c "
411- + "on c.object_id = b.object_id and a.type in('FN', 'FS', 'FT', 'IF', 'TF') "
412- + "union select "
413- + "a.name,'TRIGGER' as type,c.definition "
414- + "from sys.triggers a "
415- + "inner join sys.objects b "
416- + "on b.object_id = a.object_id "
417- + "inner join sys.sql_modules c "
418- + "on c.object_id = b.object_id) d "
419- + "where d.type = ? and d.name = ?"
420- };
31+
42132
42233 private String database = null;
42334 private String phyfileExtension = "phy";
@@ -545,14 +156,14 @@ public class RapideMetaUnloader{
545156 dao = new CmnAccessObjects(cp);
546157 conn = dao.connect();
547158 // Def tsv Writing start
548- for(int i=0;i<sql[cp.dbType].length;i++){
549- dao.select(sql[cp.dbType][i]);
550- CmnUtils.writeSeparator(folder + "/" + FILE_NAME[i] + "_" + database +"." + cp.fileExtension, dao.getColumnCount(), dao.getArrayList(), cp.delimiter);
159+ for(int i=0;i<cp.meta_sql[cp.dbType].length;i++){
160+ dao.select(cp.meta_sql[cp.dbType][i]);
161+ CmnUtils.writeSeparator(folder + "/" + cp.FILE_NAME[i] + "_" + database +"." + cp.fileExtension, dao.getColumnCount(), dao.getArrayList(), cp.delimiter);
551162 }
552163 // Def tsv Writing end
553164
554165 // Table Contents start
555- br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[TYPE_TABLE] + "_" + database + "." + cp.fileExtension));
166+ br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_TABLE] + "_" + database + "." + cp.fileExtension));
556167 subFolder = new File(folder + "/TABLES");
557168 subFolder.mkdir();
558169 pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_TABLE]))));
@@ -576,10 +187,10 @@ public class RapideMetaUnloader{
576187 if(!strLine.equals("")){
577188 strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
578189 if (!tableName.equals("")){
579- sbTbCnts.append(" " + DB_SQL_QUOTED_S[cp.dbType]+ colName + DB_SQL_QUOTED_E[cp.dbType]);
190+ sbTbCnts.append(" " + cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
580191 sbTbCnts.append(" " + colType);
581- if(!colCmnt.equals(""))sbTbCmnt.append(commentOnColumn(cp, tableName, colName, colCmnt, TYPE_TABLE));
582- if(!colCmnt.equals(""))sbTbCmnt.append(lineSeparator);
192+ if(!colCmnt.equals(""))sbTbCmnt.append(commentOnColumn(cp, tableName, colName, colCmnt, cp.TYPE_TABLE));
193+ if(!colCmnt.equals(""))sbTbCmnt.append(cp.lineSeparator);
583194 if(CmnUtils.isColPrec(colType, colPrec)){
584195 sbTbCnts.append("(" + colPrec);
585196 if (!colScale.equals("") && !colScale.equals("0"))sbTbCnts.append("," + colScale);
@@ -591,7 +202,14 @@ public class RapideMetaUnloader{
591202 sbTbCnts.append("(" + CmnUtils.getColLength(colType, colLen) + ")");
592203 }
593204 }
594- if (!colDflt.equals(""))sbTbCnts.append(" DEFAULT " + colDflt.trim());
205+ if (!colDflt.equals("")){
206+ if(CmnUtils.split(strLine, cp.SQL_COMMENT_MARK[cp.dbType]).length > 0){
207+ String [] colDfltAry = CmnUtils.split(colDflt, cp.SQL_COMMENT_MARK[cp.dbType]);
208+ sbTbCnts.append(" DEFAULT " + colDfltAry[0].trim());
209+ } else {
210+ sbTbCnts.append(" DEFAULT " + colDflt.trim());
211+ }
212+ }
595213 if (!colNoN.equals("")){
596214 sbTbCnts.append(" NOT NULL");
597215 } else {
@@ -599,39 +217,39 @@ public class RapideMetaUnloader{
599217 }
600218 if (!strSplit[0][0].equals(tableName)){
601219 pw[1].println(cp.SQL_PREFIX[cp.dbType] + "TABLES/" + tableName + ".sql");
602- pw[2].println("DROP TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ tableName + DB_SQL_QUOTED_E[cp.dbType]+ DROP_OPTION[cp.dbType] + cp.SQL_TERMINATOR[cp.dbType]);
603- pw[3].println("TRUNCATE TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ tableName + DB_SQL_QUOTED_E[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
604- sbTbCnts.append(lineSeparator);
220+ pw[2].println("DROP TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tableName + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.DROP_OPTION[cp.dbType] + cp.SQL_TERMINATOR[cp.dbType]);
221+ pw[3].println("TRUNCATE TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tableName + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
222+ sbTbCnts.append(cp.lineSeparator);
605223 sbTbCnts.append(")" + cp.SQL_TERMINATOR[cp.dbType]);
606- sbTbCnts.append(lineSeparator);
224+ sbTbCnts.append(cp.lineSeparator);
607225 pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + tableName + ".sql"))));
608- strSplit[1] = CmnUtils.split(sbTbCnts.toString(), lineSeparator);
226+ strSplit[1] = CmnUtils.split(sbTbCnts.toString(), cp.lineSeparator);
609227 for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[0].println(strSplit[1][i]);
610- strSplit[2] = CmnUtils.split(sbTbCmnt.toString(), lineSeparator);
228+ strSplit[2] = CmnUtils.split(sbTbCmnt.toString(), cp.lineSeparator);
611229 for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[0].println(strSplit[2][i]);
612230 pw[0].close();
613231 pw[0] = null;
614232 CmnUtils.infoPrint(String.format("%1$-30s",tableName) + " メタデータがアンロードされました。");
615233 sbTbCnts = new StringBuffer();
616234 sbTbCmnt = new StringBuffer();
617- sbTbCnts.append("CREATE TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][0] + DB_SQL_QUOTED_E[cp.dbType]);
618- sbTbCnts.append(lineSeparator);
235+ sbTbCnts.append("CREATE TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]);
236+ sbTbCnts.append(cp.lineSeparator);
619237 sbTbCnts.append("(");
620- sbTbCnts.append(lineSeparator);
621- if(!strSplit[0][1].equals(""))sbTbCmnt.append(commentOnTable(cp, strSplit[0][0], strSplit[0][1], TYPE_TABLE));
622- if(!strSplit[0][1].equals(""))sbTbCmnt.append(lineSeparator);
238+ sbTbCnts.append(cp.lineSeparator);
239+ if(!strSplit[0][1].equals(""))sbTbCmnt.append(commentOnTable(cp, strSplit[0][0], strSplit[0][1], cp.TYPE_TABLE));
240+ if(!strSplit[0][1].equals(""))sbTbCmnt.append(cp.lineSeparator);
623241 } else {
624242 sbTbCnts.append(",");
625- sbTbCnts.append(lineSeparator);
243+ sbTbCnts.append(cp.lineSeparator);
626244 }
627245 }
628246 else {
629- sbTbCnts.append("CREATE TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][0] + DB_SQL_QUOTED_E[cp.dbType]);
630- sbTbCnts.append(lineSeparator);
247+ sbTbCnts.append("CREATE TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]);
248+ sbTbCnts.append(cp.lineSeparator);
631249 sbTbCnts.append("(");
632- sbTbCnts.append(lineSeparator);
633- if(!strSplit[0][1].equals(""))sbTbCmnt.append(commentOnTable(cp, strSplit[0][0], strSplit[0][1], TYPE_TABLE));
634- if(!strSplit[0][1].equals(""))sbTbCmnt.append(lineSeparator);
250+ sbTbCnts.append(cp.lineSeparator);
251+ if(!strSplit[0][1].equals(""))sbTbCmnt.append(commentOnTable(cp, strSplit[0][0], strSplit[0][1], cp.TYPE_TABLE));
252+ if(!strSplit[0][1].equals(""))sbTbCmnt.append(cp.lineSeparator);
635253 }
636254 for(int i=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
637255
@@ -649,10 +267,10 @@ public class RapideMetaUnloader{
649267 }
650268
651269 if (!tableName.equals("")){
652- sbTbCnts.append(" " + DB_SQL_QUOTED_S[cp.dbType]+ colName + DB_SQL_QUOTED_E[cp.dbType]);
270+ sbTbCnts.append(" " + cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
653271 sbTbCnts.append(" " + colType);
654- if(!colCmnt.equals(""))sbTbCmnt.append(commentOnColumn(cp, tableName, colName, colCmnt, TYPE_TABLE));
655- if(!colCmnt.equals(""))sbTbCmnt.append(lineSeparator);
272+ if(!colCmnt.equals(""))sbTbCmnt.append(commentOnColumn(cp, tableName, colName, colCmnt, cp.TYPE_TABLE));
273+ if(!colCmnt.equals(""))sbTbCmnt.append(cp.lineSeparator);
656274 if(CmnUtils.isColPrec(colType, colPrec)){
657275 sbTbCnts.append("(" + colPrec);
658276 if (!colScale.equals("") && !colScale.equals("0"))sbTbCnts.append("," + colScale);
@@ -671,15 +289,15 @@ public class RapideMetaUnloader{
671289 sbTbCnts.append(" NULL");
672290 }
673291 pw[1].println(cp.SQL_PREFIX[cp.dbType] + "TABLES/" + tableName + ".sql");
674- pw[2].println("DROP TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ tableName + DB_SQL_QUOTED_E[cp.dbType]+ DROP_OPTION[cp.dbType] + cp.SQL_TERMINATOR[cp.dbType]);
675- pw[3].println("TRUNCATE TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ tableName + DB_SQL_QUOTED_E[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
676- sbTbCnts.append(lineSeparator);
292+ pw[2].println("DROP TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tableName + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.DROP_OPTION[cp.dbType] + cp.SQL_TERMINATOR[cp.dbType]);
293+ pw[3].println("TRUNCATE TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tableName + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
294+ sbTbCnts.append(cp.lineSeparator);
677295 sbTbCnts.append(")" + cp.SQL_TERMINATOR[cp.dbType]);
678- sbTbCnts.append(lineSeparator);
296+ sbTbCnts.append(cp.lineSeparator);
679297 pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + tableName + ".sql"))));
680- strSplit[1] = CmnUtils.split(sbTbCnts.toString(), lineSeparator);
298+ strSplit[1] = CmnUtils.split(sbTbCnts.toString(), cp.lineSeparator);
681299 for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[0].println(strSplit[1][i]);
682- strSplit[2] = CmnUtils.split(sbTbCmnt.toString(), lineSeparator);
300+ strSplit[2] = CmnUtils.split(sbTbCmnt.toString(), cp.lineSeparator);
683301 for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[0].println(strSplit[2][i]);
684302 pw[0].close();
685303 pw[0] = null;
@@ -692,7 +310,7 @@ public class RapideMetaUnloader{
692310 // Table Contents end
693311
694312 // Index Contents start
695- br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[TYPE_INDEX] + "_" + database + "." + cp.fileExtension));
313+ br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_INDEX] + "_" + database + "." + cp.fileExtension));
696314 pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY]))));
697315 pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY]))));
698316 pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX]))));
@@ -720,34 +338,34 @@ public class RapideMetaUnloader{
720338 if (!strSplit[0][1].equals(indexName)){
721339 //Post Process
722340 if (colPos.equals("1")){
723- sbIxCnts.append(DB_SQL_QUOTED_S[cp.dbType]+ colName + DB_SQL_QUOTED_E[cp.dbType]);
724- if (constraintType.equals("U"))sbIx2Cnts.append(DB_SQL_QUOTED_S[cp.dbType]+ colName + DB_SQL_QUOTED_E[cp.dbType]);
341+ sbIxCnts.append(cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
342+ if (constraintType.equals("U"))sbIx2Cnts.append(cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
725343 } else {
726- sbIxCnts.append(", " + DB_SQL_QUOTED_S[cp.dbType]+ colName + DB_SQL_QUOTED_E[cp.dbType]);
727- if (constraintType.equals("U"))sbIx2Cnts.append(", " + DB_SQL_QUOTED_S[cp.dbType]+ colName + DB_SQL_QUOTED_E[cp.dbType]);
344+ sbIxCnts.append(", " + cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
345+ if (constraintType.equals("U"))sbIx2Cnts.append(", " + cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
728346 }
729347 sbIxCnts.append(")" + cp.SQL_TERMINATOR[cp.dbType]);
730- sbIxCnts.append(lineSeparator);
348+ sbIxCnts.append(cp.lineSeparator);
731349 if (constraintType.equals("U"))sbIx2Cnts.append(")" + cp.SQL_TERMINATOR[cp.dbType]);
732- sbIx2Cnts.append(lineSeparator);
733- sbIx3Cnts.append(lineSeparator);
350+ sbIx2Cnts.append(cp.lineSeparator);
351+ sbIx3Cnts.append(cp.lineSeparator);
734352
735353 //Write Buffer
736354 if (constraintType.equals("P")){
737- strSplit[1] = CmnUtils.split(sbIxCnts.toString(), lineSeparator);
355+ strSplit[1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
738356 for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[0].println(strSplit[1][i]);
739- strSplit[2] = CmnUtils.split(sbIx2Cnts.toString(), lineSeparator);
357+ strSplit[2] = CmnUtils.split(sbIx2Cnts.toString(), cp.lineSeparator);
740358 for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[3].println(strSplit[2][i]);
741359 } else if (constraintType.equals("U")){
742- strSplit[1] = CmnUtils.split(sbIxCnts.toString(), lineSeparator);
360+ strSplit[1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
743361 for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[1].println(strSplit[1][i]);
744- strSplit[2] = CmnUtils.split(sbIx2Cnts.toString(), lineSeparator);
362+ strSplit[2] = CmnUtils.split(sbIx2Cnts.toString(), cp.lineSeparator);
745363 for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[4].println(strSplit[2][i]);
746364 } else if (constraintType.equals("")){
747- strSplit[1] = CmnUtils.split(sbIxCnts.toString(), lineSeparator);
365+ strSplit[1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
748366 for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[2].println(strSplit[1][i]);
749367 }
750- strSplit[3] = CmnUtils.split(sbIx3Cnts.toString(), lineSeparator);
368+ strSplit[3] = CmnUtils.split(sbIx3Cnts.toString(), cp.lineSeparator);
751369 for(int i=0;i<strSplit[3].length;i++)if(!strSplit[3][i].trim().equals(""))pw[5].println(strSplit[3][i]);
752370
753371 //Initial Process
@@ -757,22 +375,22 @@ public class RapideMetaUnloader{
757375
758376 //Index Changed Process
759377 if (strSplit[0][3].equals("P")){
760- sbIxCnts.append("ALTER TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][0] + DB_SQL_QUOTED_E[cp.dbType]+ " ADD CONSTRAINT " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][1] + DB_SQL_QUOTED_E[cp.dbType]+ " PRIMARY KEY(");
761- sbIx2Cnts.append("ALTER TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][0] + DB_SQL_QUOTED_E[cp.dbType]+ " DROP CONSTRAINT " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][1] + DB_SQL_QUOTED_E[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
378+ sbIxCnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ADD CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][1] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " PRIMARY KEY(");
379+ sbIx2Cnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " DROP CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][1] + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
762380 } else if (strSplit[0][3].equals("U")){
763- sbIxCnts.append("ALTER TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][0] + DB_SQL_QUOTED_E[cp.dbType]+ " ADD CONSTRAINT " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][1] + DB_SQL_QUOTED_E[cp.dbType]+ " UNIQUE(");
764- sbIx2Cnts.append("ALTER TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][0] + DB_SQL_QUOTED_E[cp.dbType]+ " DROP UNIQUE(");
381+ sbIxCnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ADD CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][1] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " UNIQUE(");
382+ sbIx2Cnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " DROP UNIQUE(");
765383 } else if (strSplit[0][3].equals("")){
766- sbIxCnts.append("CREATE INDEX " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][1] + DB_SQL_QUOTED_E[cp.dbType]+ " ON " + strSplit[0][0] + "(");
384+ sbIxCnts.append("CREATE INDEX " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][1] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ON " + strSplit[0][0] + "(");
767385 }
768- sbIx3Cnts.append("DROP INDEX " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][1] + DB_SQL_QUOTED_E[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
386+ sbIx3Cnts.append("DROP INDEX " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][1] + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
769387 } else if (strSplit[0][1].equals(indexName)){
770388 if (colPos.equals("1")){
771- sbIxCnts.append(DB_SQL_QUOTED_S[cp.dbType]+ colName + DB_SQL_QUOTED_E[cp.dbType]);
772- if (constraintType.equals("U"))sbIx2Cnts.append(DB_SQL_QUOTED_S[cp.dbType]+ colName + DB_SQL_QUOTED_E[cp.dbType]);
389+ sbIxCnts.append(cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
390+ if (constraintType.equals("U"))sbIx2Cnts.append(cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
773391 } else {
774- sbIxCnts.append(", " + DB_SQL_QUOTED_S[cp.dbType]+ colName + DB_SQL_QUOTED_E[cp.dbType]);
775- if (constraintType.equals("U"))sbIx2Cnts.append(", " + DB_SQL_QUOTED_S[cp.dbType]+ colName + DB_SQL_QUOTED_E[cp.dbType]);
392+ sbIxCnts.append(", " + cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
393+ if (constraintType.equals("U"))sbIx2Cnts.append(", " + cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
776394 }
777395 }
778396 }
@@ -780,15 +398,15 @@ public class RapideMetaUnloader{
780398 //1st Line Process
781399 else {
782400 if (strSplit[0][3].equals("P")){
783- sbIxCnts.append("ALTER TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][0] + DB_SQL_QUOTED_E[cp.dbType]+ " ADD CONSTRAINT " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][1] + DB_SQL_QUOTED_E[cp.dbType]+ " PRIMARY KEY(");
784- sbIx2Cnts.append("ALTER TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][0] + DB_SQL_QUOTED_E[cp.dbType]+ " DROP CONSTRAINT " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][1] + DB_SQL_QUOTED_E[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
401+ sbIxCnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ADD CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][1] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " PRIMARY KEY(");
402+ sbIx2Cnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " DROP CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][1] + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
785403 } else if (strSplit[0][3].equals("U")){
786- sbIxCnts.append("ALTER TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][0] + DB_SQL_QUOTED_E[cp.dbType]+ " ADD CONSTRAINT " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][1] + DB_SQL_QUOTED_E[cp.dbType]+ " UNIQUE(");
787- sbIx2Cnts.append("ALTER TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][0] + DB_SQL_QUOTED_E[cp.dbType]+ " DROP UNIQUE(");
404+ sbIxCnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ADD CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][1] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " UNIQUE(");
405+ sbIx2Cnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " DROP UNIQUE(");
788406 } else if (strSplit[0][3].equals("")){
789- sbIxCnts.append("CREATE INDEX " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][1] + DB_SQL_QUOTED_E[cp.dbType]+ " ON " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][0] + DB_SQL_QUOTED_E[cp.dbType]+ "(");
407+ sbIxCnts.append("CREATE INDEX " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][1] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ON " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]+ "(");
790408 }
791- sbIx3Cnts.append("DROP INDEX " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][1] + DB_SQL_QUOTED_E[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
409+ sbIx3Cnts.append("DROP INDEX " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][1] + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
792410 }
793411 for(int i=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
794412
@@ -803,34 +421,34 @@ public class RapideMetaUnloader{
803421 if (!indexName.equals("")){
804422 //Post Process
805423 if (colPos.equals("1")){
806- sbIxCnts.append(DB_SQL_QUOTED_S[cp.dbType]+ colName + DB_SQL_QUOTED_E[cp.dbType]);
807- if (constraintType.equals("U"))sbIx2Cnts.append(DB_SQL_QUOTED_S[cp.dbType]+ colName + DB_SQL_QUOTED_E[cp.dbType]);
424+ sbIxCnts.append(cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
425+ if (constraintType.equals("U"))sbIx2Cnts.append(cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
808426 } else {
809- sbIxCnts.append(", " + DB_SQL_QUOTED_S[cp.dbType]+ colName + DB_SQL_QUOTED_E[cp.dbType]);
810- if (constraintType.equals("U"))sbIx2Cnts.append(", " + DB_SQL_QUOTED_S[cp.dbType]+ colName + DB_SQL_QUOTED_E[cp.dbType]);
427+ sbIxCnts.append(", " + cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
428+ if (constraintType.equals("U"))sbIx2Cnts.append(", " + cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
811429 }
812430 sbIxCnts.append(")" + cp.SQL_TERMINATOR[cp.dbType]);
813- sbIxCnts.append(lineSeparator);
431+ sbIxCnts.append(cp.lineSeparator);
814432 if (constraintType.equals("U"))sbIx2Cnts.append(")" + cp.SQL_TERMINATOR[cp.dbType]);
815- sbIx2Cnts.append(lineSeparator);
816- sbIx3Cnts.append(lineSeparator);
433+ sbIx2Cnts.append(cp.lineSeparator);
434+ sbIx3Cnts.append(cp.lineSeparator);
817435
818436 //Write Buffer
819437 if (constraintType.equals("P")){
820- strSplit[1] = CmnUtils.split(sbIxCnts.toString(), lineSeparator);
438+ strSplit[1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
821439 for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[0].println(strSplit[1][i]);
822- strSplit[2] = CmnUtils.split(sbIx2Cnts.toString(), lineSeparator);
440+ strSplit[2] = CmnUtils.split(sbIx2Cnts.toString(), cp.lineSeparator);
823441 for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[3].println(strSplit[2][i]);
824442 } else if (constraintType.equals("U")){
825- strSplit[1] = CmnUtils.split(sbIxCnts.toString(), lineSeparator);
443+ strSplit[1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
826444 for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[1].println(strSplit[1][i]);
827- strSplit[2] = CmnUtils.split(sbIx2Cnts.toString(), lineSeparator);
445+ strSplit[2] = CmnUtils.split(sbIx2Cnts.toString(), cp.lineSeparator);
828446 for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[4].println(strSplit[2][i]);
829447 } else if (constraintType.equals("")){
830- strSplit[1] = CmnUtils.split(sbIxCnts.toString(), lineSeparator);
448+ strSplit[1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
831449 for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[2].println(strSplit[1][i]);
832450 }
833- strSplit[3] = CmnUtils.split(sbIx3Cnts.toString(), lineSeparator);
451+ strSplit[3] = CmnUtils.split(sbIx3Cnts.toString(), cp.lineSeparator);
834452 for(int i=0;i<strSplit[3].length;i++)if(!strSplit[3][i].trim().equals(""))pw[5].println(strSplit[3][i]);
835453 }
836454
@@ -842,7 +460,7 @@ public class RapideMetaUnloader{
842460 // Index Contents end
843461
844462 // View Contents start
845- br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[TYPE_VIEW] + "_" + database + "." + cp.fileExtension));
463+ br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_VIEW] + "_" + database + "." + cp.fileExtension));
846464 subFolder = new File(folder + "/VIEWS");
847465 subFolder.mkdir();
848466 pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_VIEW]))));
@@ -851,32 +469,32 @@ public class RapideMetaUnloader{
851469 strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
852470 CmnUtils.debugPrint("'" + strSplit[0][0] + "'");
853471 pw[1].println(cp.SQL_PREFIX[cp.dbType] + "VIEWS/" + strSplit[0][0] + ".sql");
854- pw[2].println("DROP VIEW " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][0] + DB_SQL_QUOTED_E[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
472+ pw[2].println("DROP VIEW " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
855473 if (strSplit[0].length>1)CmnUtils.debugPrint("'" + strSplit[0][1] + "'");
856474 pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + strSplit[0][0] + ".sql"))));
857475
858- stmt = dao.prepareSql(sql_view_column_and_comment[cp.dbType]);
476+ stmt = dao.prepareSql(cp.sql_view_column_and_comment[cp.dbType]);
859477 stmt.setString(1,strSplit[0][0]);
860478 dao.executeSql();
861479 alData = dao.getArrayList();
862480 columnCount = dao.getColumnCount();
863481 if (cp.dbType == cp.DB_TYPE_ORACLE){
864482 pw[0].println("/* " + strSplit[0][0] + " */");
865- pw[0].println("CREATE OR REPLACE VIEW " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][0] + DB_SQL_QUOTED_E[cp.dbType]);
483+ pw[0].println("CREATE OR REPLACE VIEW " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]);
866484 pw[0].println("(");
867485 for(int i=0;i<alData.size();i++){
868486 if ((i+1) % columnCount == 1){
869487 if (i == 0){
870488 if (!alData.get(i+1).trim().equals("")){
871- pw[0].println(" " + DB_SQL_QUOTED_S[cp.dbType]+ alData.get(i) + DB_SQL_QUOTED_E[cp.dbType]+ " -- " + alData.get(i+1));
489+ pw[0].println(" " + cp.DB_SQL_QUOTEDS[cp.dbType]+ alData.get(i) + cp.DB_SQL_QUOTEDE[cp.dbType]+ " -- " + alData.get(i+1));
872490 } else {
873- pw[0].println(" " + DB_SQL_QUOTED_S[cp.dbType]+ alData.get(i) + DB_SQL_QUOTED_E[cp.dbType]);
491+ pw[0].println(" " + cp.DB_SQL_QUOTEDS[cp.dbType]+ alData.get(i) + cp.DB_SQL_QUOTEDE[cp.dbType]);
874492 }
875493 } else {
876494 if (!alData.get(i+1).trim().equals("")){
877- pw[0].println(" ," + DB_SQL_QUOTED_S[cp.dbType]+ alData.get(i) + DB_SQL_QUOTED_E[cp.dbType]+ " -- " + alData.get(i+1));
495+ pw[0].println(" ," + cp.DB_SQL_QUOTEDS[cp.dbType]+ alData.get(i) + cp.DB_SQL_QUOTEDE[cp.dbType]+ " -- " + alData.get(i+1));
878496 } else {
879- pw[0].println(" ," + DB_SQL_QUOTED_S[cp.dbType]+ alData.get(i) + DB_SQL_QUOTED_E[cp.dbType]);
497+ pw[0].println(" ," + cp.DB_SQL_QUOTEDS[cp.dbType]+ alData.get(i) + cp.DB_SQL_QUOTEDE[cp.dbType]);
880498 }
881499 }
882500 }
@@ -884,19 +502,19 @@ public class RapideMetaUnloader{
884502 pw[0].println(")");
885503 pw[0].println("AS");
886504 }
887- stmt = dao.prepareSql(sql_view_text[cp.dbType]);
505+ stmt = dao.prepareSql(cp.sql_view_text[cp.dbType]);
888506 stmt.setString(1,strSplit[0][0]);
889507 dao.executeSql();
890508 alData2 = dao.getArrayList();
891509 strContents = alData2.get(0).trim();
892- strSplit[1] = CmnUtils.split(strContents, lineSeparator);
510+ strSplit[1] = CmnUtils.split(strContents, cp.lineSeparator);
893511 for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[0].println(strSplit[1][i].replaceAll("\"\"","\"").replaceAll(Pattern.quote(cp.user.toUpperCase() + "."),"").replaceAll(Pattern.quote(cp.user.toLowerCase() + "."),""));
894512 pw[0].println(cp.SQL_TERMINATOR[cp.dbType]);
895513
896- if (!strSplit[0][1].trim().equals(""))pw[0].println(commentOnTable(cp, strSplit[0][0], strSplit[0][1], TYPE_VIEW));
514+ if (!strSplit[0][1].trim().equals(""))pw[0].println(commentOnTable(cp, strSplit[0][0], strSplit[0][1], cp.TYPE_VIEW));
897515 for(int i=0;i<alData.size();i++){
898516 if ((i+1) % columnCount == 0){
899- if (!alData.get(i).trim().equals(""))pw[0].println(commentOnColumn(cp, strSplit[0][0], alData.get(i-1), alData.get(i), TYPE_VIEW));
517+ if (!alData.get(i).trim().equals(""))pw[0].println(commentOnColumn(cp, strSplit[0][0], alData.get(i-1), alData.get(i), cp.TYPE_VIEW));
900518 }
901519 }
902520 pw[0].close();
@@ -910,7 +528,7 @@ public class RapideMetaUnloader{
910528 // View Contents end
911529
912530 // Procedure Contents start
913- br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[TYPE_PROCEDURE] + "_" + database + "." + cp.fileExtension));
531+ br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_PROCEDURE] + "_" + database + "." + cp.fileExtension));
914532 subFolder = new File(folder + "/PROCEDURES");
915533 subFolder.mkdir();
916534 pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PROCEDURE]))));
@@ -926,7 +544,7 @@ public class RapideMetaUnloader{
926544 pw[0].println("/* " + strSplit[0][0] + " */");
927545 pw[0].print("CREATE OR REPLACE ");
928546 }
929- stmt = dao.prepareSql(sql_proc[cp.dbType]);
547+ stmt = dao.prepareSql(cp.sql_proc[cp.dbType]);
930548 stmt.setString(1,strSplit[0][1]);
931549 stmt.setString(2,strSplit[0][0]);
932550 dao.executeSql();
@@ -951,7 +569,7 @@ public class RapideMetaUnloader{
951569 // Procedure Contents end
952570
953571 // Sequence Contents start
954- br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[TYPE_SEQ] + "_" + database + "." + cp.fileExtension));
572+ br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_SEQ] + "_" + database + "." + cp.fileExtension));
955573 pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_SEQUENCE]))));
956574 pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_SEQUENCE]))));
957575
@@ -966,7 +584,7 @@ public class RapideMetaUnloader{
966584 cacheSz = strSplit[0][6];
967585 if(cacheSz.equals("0"))cacheSz="10";
968586 lstNo = strSplit[0][7];
969- pw[1].print("CREATE SEQUENCE " + DB_SQL_QUOTED_S[cp.dbType]+ seqName + DB_SQL_QUOTED_E[cp.dbType]+ " MINVALUE " + minVal + " MAXVALUE " + maxVal + " INCREMENT BY " + incSz + " START WITH " + lstNo);
587+ pw[1].print("CREATE SEQUENCE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ seqName + cp.DB_SQL_QUOTEDE[cp.dbType]+ " MINVALUE " + minVal + " MAXVALUE " + maxVal + " INCREMENT BY " + incSz + " START WITH " + lstNo);
970588 if (cp.dbType == cp.DB_TYPE_ORACLE){
971589 pw[1].print(" CACHE " + cacheSz);
972590 if (odFg.equals("N")){
@@ -992,7 +610,7 @@ public class RapideMetaUnloader{
992610 }
993611 }
994612 pw[1].println(cp.SQL_TERMINATOR[cp.dbType]);
995- pw[2].println("DROP SEQUENCE " + DB_SQL_QUOTED_S[cp.dbType]+ seqName + DB_SQL_QUOTED_E[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
613+ pw[2].println("DROP SEQUENCE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ seqName + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
996614 for(int i=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
997615 }
998616 for(int i=1;i<3;i++)pw[i].close();
@@ -1002,7 +620,7 @@ public class RapideMetaUnloader{
1002620 // Sequence Contents end
1003621
1004622 // Synonym Contents start
1005- br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[TYPE_SYNONYM] + "_" + database + "." + cp.fileExtension));
623+ br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_SYNONYM] + "_" + database + "." + cp.fileExtension));
1006624 pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_SYNONYM]))));
1007625 pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_SYNONYM]))));
1008626
@@ -1013,18 +631,18 @@ public class RapideMetaUnloader{
1013631 tbName = strSplit[0][2];
1014632 dbLnk = strSplit[0][3];
1015633
1016- pw[1].print("CREATE SYNONYM " + DB_SQL_QUOTED_S[cp.dbType]+ synmName + DB_SQL_QUOTED_E[cp.dbType]+ " FOR ");
634+ pw[1].print("CREATE SYNONYM " + cp.DB_SQL_QUOTEDS[cp.dbType]+ synmName + cp.DB_SQL_QUOTEDE[cp.dbType]+ " FOR ");
1017635 if(cp.dbType == cp.DB_TYPE_ORACLE){
1018636 if(!dbLnk.equals("")){
1019- pw[1].print(DB_SQL_QUOTED_S[cp.dbType]+ tbName + DB_SQL_QUOTED_E[cp.dbType]+ "@" + DB_SQL_QUOTED_S[cp.dbType]+ dbLnk + DB_SQL_QUOTED_S[cp.dbType]);
637+ pw[1].print(cp.DB_SQL_QUOTEDS[cp.dbType]+ tbName + cp.DB_SQL_QUOTEDE[cp.dbType]+ "@" + cp.DB_SQL_QUOTEDS[cp.dbType]+ dbLnk + cp.DB_SQL_QUOTEDS[cp.dbType]);
1020638 } else {
1021- pw[1].print(DB_SQL_QUOTED_S[cp.dbType]+ tbOwner + DB_SQL_QUOTED_E[cp.dbType]+ "." + DB_SQL_QUOTED_S[cp.dbType]+ tbName + DB_SQL_QUOTED_E[cp.dbType]);
639+ pw[1].print(cp.DB_SQL_QUOTEDS[cp.dbType]+ tbOwner + cp.DB_SQL_QUOTEDE[cp.dbType]+ "." + cp.DB_SQL_QUOTEDS[cp.dbType]+ tbName + cp.DB_SQL_QUOTEDE[cp.dbType]);
1022640 }
1023641 } else if(cp.dbType == cp.DB_TYPE_SQLSERVER){
1024642 pw[1].print(tbName);
1025643 }
1026644 pw[1].println(cp.SQL_TERMINATOR[cp.dbType]);
1027- pw[2].println("DROP SYNONYM " + DB_SQL_QUOTED_S[cp.dbType]+ synmName + DB_SQL_QUOTED_E[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
645+ pw[2].println("DROP SYNONYM " + cp.DB_SQL_QUOTEDS[cp.dbType]+ synmName + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
1028646 for(int i=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
1029647 }
1030648 for(int i=1;i<3;i++)pw[i].close();
@@ -1034,9 +652,9 @@ public class RapideMetaUnloader{
1034652 // Synonym Contents end
1035653
1036654 // Fk Contents start
1037- File tsvFile = new File(folder + "/" + FILE_NAME[TYPE_FK] + "_" + database + "." + cp.fileExtension);
655+ File tsvFile = new File(folder + "/" + cp.FILE_NAME[cp.TYPE_FK] + "_" + database + "." + cp.fileExtension);
1038656 if (tsvFile.length() > 0) {
1039- br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[TYPE_FK] + "_" + database + "." + cp.fileExtension));
657+ br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_FK] + "_" + database + "." + cp.fileExtension));
1040658 pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_FK]))));
1041659 pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_FK]))));
1042660 tbName = "";
@@ -1050,8 +668,8 @@ public class RapideMetaUnloader{
1050668 while((strLine=br[0].readLine()) != null){
1051669 strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
1052670 if(!fkName.equals(strSplit[0][1]) && !fkName.equals("")){
1053- pw[1].println("ALTER TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ tbName + DB_SQL_QUOTED_E[cp.dbType]+ " ADD CONSTRAINT " + DB_SQL_QUOTED_S[cp.dbType]+ fkName + DB_SQL_QUOTED_E[cp.dbType]+ " FOREIGN KEY (" + DB_SQL_QUOTED_S[cp.dbType]+ fkCol + DB_SQL_QUOTED_E[cp.dbType]+ ") REFERENCES " + DB_SQL_QUOTED_S[cp.dbType]+ rtbName + DB_SQL_QUOTED_E[cp.dbType]+ " (" + DB_SQL_QUOTED_S[cp.dbType]+ rfkCol + DB_SQL_QUOTED_E[cp.dbType]+ ")" + cp.SQL_TERMINATOR[cp.dbType]);
1054- pw[2].println("ALTER TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ tbName + DB_SQL_QUOTED_E[cp.dbType]+ " DROP CONSTRAINT " + DB_SQL_QUOTED_S[cp.dbType]+ fkName + DB_SQL_QUOTED_E[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
671+ pw[1].println("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tbName + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ADD CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ fkName + cp.DB_SQL_QUOTEDE[cp.dbType]+ " FOREIGN KEY (" + cp.DB_SQL_QUOTEDS[cp.dbType]+ fkCol + cp.DB_SQL_QUOTEDE[cp.dbType]+ ") REFERENCES " + cp.DB_SQL_QUOTEDS[cp.dbType]+ rtbName + cp.DB_SQL_QUOTEDE[cp.dbType]+ " (" + cp.DB_SQL_QUOTEDS[cp.dbType]+ rfkCol + cp.DB_SQL_QUOTEDE[cp.dbType]+ ")" + cp.SQL_TERMINATOR[cp.dbType]);
672+ pw[2].println("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tbName + cp.DB_SQL_QUOTEDE[cp.dbType]+ " DROP CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ fkName + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
1055673 for(int i=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
1056674 tbName = strSplit[0][0];
1057675 fkName = strSplit[0][1];
@@ -1074,15 +692,15 @@ public class RapideMetaUnloader{
1074692 (cp.dbType == cp.DB_TYPE_ORACLE && strSplit[0][3].equals(strSplit[0][6])) ||
1075693 cp.dbType != cp.DB_TYPE_ORACLE
1076694 ) {
1077- fkCol = fkCol + DB_SQL_QUOTED_E[cp.dbType]+ ", " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][2];
1078- rfkCol = rfkCol + DB_SQL_QUOTED_E[cp.dbType]+ ", " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][5];
695+ fkCol = fkCol + cp.DB_SQL_QUOTEDE[cp.dbType]+ ", " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][2];
696+ rfkCol = rfkCol + cp.DB_SQL_QUOTEDE[cp.dbType]+ ", " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][5];
1079697 }
1080698 }
1081699 }
1082700
1083701 }
1084- pw[1].println("ALTER TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ tbName + DB_SQL_QUOTED_E[cp.dbType]+ " ADD CONSTRAINT " + DB_SQL_QUOTED_S[cp.dbType]+ fkName + DB_SQL_QUOTED_E[cp.dbType]+ " FOREIGN KEY (" + DB_SQL_QUOTED_S[cp.dbType]+ fkCol + DB_SQL_QUOTED_E[cp.dbType]+ ") REFERENCES " + DB_SQL_QUOTED_S[cp.dbType]+ rtbName + DB_SQL_QUOTED_E[cp.dbType]+ " (" + DB_SQL_QUOTED_S[cp.dbType]+ rfkCol + DB_SQL_QUOTED_E[cp.dbType]+ ")" + cp.SQL_TERMINATOR[cp.dbType]);
1085- pw[2].println("ALTER TABLE " + DB_SQL_QUOTED_S[cp.dbType]+ tbName + DB_SQL_QUOTED_E[cp.dbType]+ " DROP CONSTRAINT " + DB_SQL_QUOTED_S[cp.dbType]+ fkName + DB_SQL_QUOTED_E[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
702+ pw[1].println("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tbName + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ADD CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ fkName + cp.DB_SQL_QUOTEDE[cp.dbType]+ " FOREIGN KEY (" + cp.DB_SQL_QUOTEDS[cp.dbType]+ fkCol + cp.DB_SQL_QUOTEDE[cp.dbType]+ ") REFERENCES " + cp.DB_SQL_QUOTEDS[cp.dbType]+ rtbName + cp.DB_SQL_QUOTEDE[cp.dbType]+ " (" + cp.DB_SQL_QUOTEDS[cp.dbType]+ rfkCol + cp.DB_SQL_QUOTEDE[cp.dbType]+ ")" + cp.SQL_TERMINATOR[cp.dbType]);
703+ pw[2].println("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tbName + cp.DB_SQL_QUOTEDE[cp.dbType]+ " DROP CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ fkName + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
1086704 for(int i=1;i<3;i++)pw[i].close();
1087705 for(int i=1;i<3;i++)pw[i]=null;
1088706 br[0].close();
@@ -1093,7 +711,7 @@ public class RapideMetaUnloader{
1093711 // Rhysical Contents start
1094712 if(cp.isPhysical && cp.dbType == cp.DB_TYPE_ORACLE){
1095713 // physical index setting
1096- br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[TYPE_OBJ] + "_" + database + "." + cp.fileExtension));
714+ br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_OBJ] + "_" + database + "." + cp.fileExtension));
1097715 br[1] = new BufferedReader(new FileReader(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY]));
1098716 br[2] = new BufferedReader(new FileReader(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY]));
1099717 br[3] = new BufferedReader(new FileReader(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX]));
@@ -1132,7 +750,7 @@ public class RapideMetaUnloader{
1132750 if(!freeLst.equals(""))pw[1].print(" FREELISTS " + freeLst);
1133751 if(!flstGrp.equals(""))pw[1].print(" FREELIST GROUPS " + flstGrp);
1134752 pw[1].print(" BUFFER_POOL " + bufPool + ")");
1135- pw[1].print(" TABLESPACE " + DB_SQL_QUOTED_S[cp.dbType]+ tblSpace + DB_SQL_QUOTED_E[cp.dbType]);
753+ pw[1].print(" TABLESPACE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tblSpace + cp.DB_SQL_QUOTEDE[cp.dbType]);
1136754 if(logging.equals("NO")){
1137755 pw[1].println(" NOLOGGING" + cp.SQL_TERMINATOR[cp.dbType]);
1138756 } else {
@@ -1168,7 +786,7 @@ public class RapideMetaUnloader{
1168786 if(!freeLst.equals(""))pw[2].print(" FREELISTS " + freeLst);
1169787 if(!flstGrp.equals(""))pw[2].print(" FREELIST GROUPS " + flstGrp);
1170788 pw[2].print(" BUFFER_POOL " + bufPool + ")");
1171- pw[2].print(" TABLESPACE " + DB_SQL_QUOTED_S[cp.dbType]+ tblSpace + DB_SQL_QUOTED_E[cp.dbType]);
789+ pw[2].print(" TABLESPACE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tblSpace + cp.DB_SQL_QUOTEDE[cp.dbType]);
1172790 if(logging.equals("NO")){
1173791 pw[2].println(" NOLOGGING" + cp.SQL_TERMINATOR[cp.dbType]);
1174792 } else {
@@ -1204,7 +822,7 @@ public class RapideMetaUnloader{
1204822 if(!freeLst.equals(""))pw[3].print(" FREELISTS " + freeLst);
1205823 if(!flstGrp.equals(""))pw[3].print(" FREELIST GROUPS " + flstGrp);
1206824 pw[3].print(" BUFFER_POOL " + bufPool + ")");
1207- pw[3].print(" TABLESPACE " + DB_SQL_QUOTED_S[cp.dbType]+ tblSpace + DB_SQL_QUOTED_E[cp.dbType]);
825+ pw[3].print(" TABLESPACE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tblSpace + cp.DB_SQL_QUOTEDE[cp.dbType]);
1208826 if(logging.equals("NO")){
1209827 pw[3].println(" NOLOGGING" + cp.SQL_TERMINATOR[cp.dbType]);
1210828 } else {
@@ -1272,7 +890,7 @@ public class RapideMetaUnloader{
1272890 if(!freeLst.equals(""))pw[0].print(" FREELISTS " + freeLst);
1273891 if(!flstGrp.equals(""))pw[0].print(" FREELIST GROUPS " + flstGrp);
1274892 pw[0].print(" BUFFER_POOL " + bufPool + ")");
1275- pw[0].print(" TABLESPACE " + DB_SQL_QUOTED_S[cp.dbType]+ tblSpace + DB_SQL_QUOTED_E[cp.dbType]);
893+ pw[0].print(" TABLESPACE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tblSpace + cp.DB_SQL_QUOTEDE[cp.dbType]);
1276894 if(logging.equals("NO")){
1277895 pw[0].println(" NOLOGGING" + cp.SQL_TERMINATOR[cp.dbType]);
1278896 } else {
@@ -1297,8 +915,8 @@ public class RapideMetaUnloader{
1297915
1298916 // Remove work file
1299917 File fl= null;
1300- for(int i=0;i<sql[cp.dbType].length;i++){
1301- fl= new File(folder + "/" + FILE_NAME[i] + "_" + database + "." + cp.fileExtension);
918+ for(int i=0;i<cp.meta_sql[cp.dbType].length;i++){
919+ fl= new File(folder + "/" + cp.FILE_NAME[i] + "_" + database + "." + cp.fileExtension);
1302920 CmnUtils.debugPrint(fl.toString());
1303921 fl.delete();
1304922 }
@@ -1344,18 +962,14 @@ public class RapideMetaUnloader{
1344962 private String commentOnTable(CmnProps _cp, String _tableName, String _tableCmnt, int _type) throws Exception{
1345963 String retVal = "";
1346964 if(!_tableCmnt.equals("")){
1347- switch (_cp.dbType) {
1348- case DB_TYPE_ORACLE:
1349- retVal = "COMMENT ON TABLE " + DB_SQL_QUOTED_S[_cp.dbType]+ _tableName + DB_SQL_QUOTED_E[_cp.dbType]+ " IS '" + _tableCmnt.replaceAll("'","''") + "'" + _cp.SQL_TERMINATOR[_cp.dbType];
1350- break;
1351- case DB_TYPE_SQLSERVER:
1352- if(_type == TYPE_TABLE){
965+ if(_cp.dbType == _cp.DB_TYPE_ORACLE){
966+ retVal = "COMMENT ON TABLE " + _cp.DB_SQL_QUOTEDS[_cp.dbType]+ _tableName + _cp.DB_SQL_QUOTEDE[_cp.dbType]+ " IS '" + _tableCmnt.replaceAll("'","''") + "'" + _cp.SQL_TERMINATOR[_cp.dbType];
967+ } else if(_cp.dbType == _cp.DB_TYPE_SQLSERVER){
968+ if(_type == _cp.TYPE_TABLE){
1353969 retVal = "exec sys.sp_addextendedproperty @name=N'MS_Description',@value=N'" + _tableCmnt.replaceAll("'","''") + "',@level0type=N'schema',@level0name=N'dbo',@level1type=N'table',@level1name=N'" + _tableName + "'" + _cp.SQL_TERMINATOR[_cp.dbType];
1354- } else if(_type == TYPE_VIEW){
970+ } else if(_type == _cp.TYPE_VIEW){
1355971 retVal = "exec sys.sp_addextendedproperty @name=N'MS_Description',@value=N'" + _tableCmnt.replaceAll("'","''") + "',@level0type=N'schema',@level0name=N'dbo',@level1type=N'view',@level1name=N'" + _tableName + "'" + _cp.SQL_TERMINATOR[_cp.dbType];
1356972 }
1357- break;
1358- default :
1359973 }
1360974 }
1361975 return retVal;
@@ -1363,18 +977,14 @@ public class RapideMetaUnloader{
1363977 private String commentOnColumn(CmnProps _cp, String _tableName, String _colName, String _colCmnt, int _type) throws Exception{
1364978 String retVal = "";
1365979 if(!_colCmnt.equals("")){
1366- switch (_cp.dbType) {
1367- case DB_TYPE_ORACLE:
1368- retVal = "COMMENT ON COLUMN " + DB_SQL_QUOTED_S[_cp.dbType]+ _tableName + DB_SQL_QUOTED_E[_cp.dbType]+ "." + DB_SQL_QUOTED_S[_cp.dbType]+ _colName + DB_SQL_QUOTED_E[_cp.dbType]+ " IS '" + _colCmnt.replaceAll("'","''") + "'" + _cp.SQL_TERMINATOR[_cp.dbType];
1369- break;
1370- case DB_TYPE_SQLSERVER:
1371- if(_type == TYPE_TABLE){
980+ if(_cp.dbType == _cp.DB_TYPE_ORACLE){
981+ retVal = "COMMENT ON COLUMN " + _cp.DB_SQL_QUOTEDS[_cp.dbType]+ _tableName + _cp.DB_SQL_QUOTEDE[_cp.dbType]+ "." + _cp.DB_SQL_QUOTEDS[_cp.dbType]+ _colName + _cp.DB_SQL_QUOTEDE[_cp.dbType]+ " IS '" + _colCmnt.replaceAll("'","''") + "'" + _cp.SQL_TERMINATOR[_cp.dbType];
982+ } else if(_cp.dbType == _cp.DB_TYPE_SQLSERVER){
983+ if(_type == _cp.TYPE_TABLE){
1372984 retVal = "exec sys.sp_addextendedproperty @name=N'MS_Description',@value=N'" + _colCmnt.replaceAll("'","''") + "',@level0type=N'schema',@level0name=N'dbo',@level1type=N'table',@level1name=N'" + _tableName + "',@level2type=N'column',@level2name=N'" + _colName + "'" + _cp.SQL_TERMINATOR[_cp.dbType];
1373- } else if(_type == TYPE_VIEW){
985+ } else if(_type == _cp.TYPE_VIEW){
1374986 retVal = "exec sys.sp_addextendedproperty @name=N'MS_Description',@value=N'" + _colCmnt.replaceAll("'","''") + "',@level0type=N'schema',@level0name=N'dbo',@level1type=N'view',@level1name=N'" + _tableName + "',@level2type=N'column',@level2name=N'" + _colName + "'" + _cp.SQL_TERMINATOR[_cp.dbType];
1375987 }
1376- break;
1377- default :
1378988 }
1379989 }
1380990 return retVal;
Show on old repository browser