• R/O
  • HTTP
  • SSH
  • HTTPS

rapideact: Commit


Commit MetaInfo

Revision3d8f754824a4b44f76f9c1f2fc16d87d1e004283 (tree)
Time2017-05-14 07:43:54
Authorkuboryu <kuboryu@yaho...>
Commiterkuboryu

Log Message

20170514

Change Summary

Incremental Difference

--- a/com/rapide_act/RapideMetaUnloader.java
+++ b/com/rapide_act/RapideMetaUnloader.java
@@ -192,13 +192,12 @@ public class RapideMetaUnloader{
192192 + " order by"
193193 + " a.table_name,"
194194 + " a.object_name",
195- "select "
195+ "select distinct "
196196 + " a.table_name as table_name, "
197197 + " a.constraint_name as constraint_name, "
198198 + " b.column_name as column_name, "
199199 + " b.position as position,"
200200 + " c.table_name as r_table_name, "
201- + " c.constraint_name as r_constraint_name, "
202201 + " d.column_name as r_column_name, "
203202 + " d.position as r_position "
204203 + " from "
@@ -309,11 +308,13 @@ public class RapideMetaUnloader{
309308 + " from sys.sequences "
310309 + " order by name",
311310 "select "
312- + " name as synonym_name,"
313- + " schema_id as table_owner,"
311+ + " a.name as synonym_name,"
312+ + " b.name as table_owner,"
314313 + " base_object_name as table_name,"
315314 + " '' as db_link "
316- + "from sys.synonyms "
315+ + "from sys.synonyms a "
316+ + " inner join sys.schemas as b "
317+ + " on a.schema_id = b.schema_id "
317318 + "order by synonym_name,table_owner,table_name",
318319 "select "
319320 + " c.name as table_name, "
@@ -331,13 +332,12 @@ public class RapideMetaUnloader{
331332 + " inner join sys.indexes as d "
332333 + " on b.index_id = d.index_id and d.object_id = b.object_id "
333334 + "order by c.name, b.index_id",
334- "select "
335+ "select distinct "
335336 + " c.name as table_name, "
336337 + " a.name as constraint_name, "
337338 + " d.name as column_name, "
338339 + " b.constraint_column_id as position, "
339340 + " e.name as r_table_name, "
340- + " g.name as r_constraint_name, "
341341 + " f.name as r_column_name ,"
342342 + " f.column_id as r_position "
343343 + "from sys.foreign_keys as a "
@@ -966,16 +966,30 @@ public class RapideMetaUnloader{
966966 cacheSz = strSplit[0][6];
967967 if(cacheSz.equals("0"))cacheSz="10";
968968 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 + " CACHE " + cacheSz);
970- if (odFg.equals("N")){
971- pw[1].print(" NOORDER");
972- } else {
973- pw[1].print(" ORDER");
974- }
975- if (cycFg.equals("N")){
976- pw[1].print(" NOCYCLE");
977- } else {
978- pw[1].print(" CYCLE");
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);
970+ if (cp.dbType == cp.DB_TYPE_ORACLE){
971+ pw[1].print(" CACHE " + cacheSz);
972+ if (odFg.equals("N")){
973+ pw[1].print(" NOORDER");
974+ } else {
975+ pw[1].print(" ORDER");
976+ }
977+ if (cycFg.equals("N")){
978+ pw[1].print(" NOCYCLE");
979+ } else {
980+ pw[1].print(" CYCLE");
981+ }
982+ } else if (cp.dbType == cp.DB_TYPE_SQLSERVER){
983+ if (cacheSz.equals("")){
984+ pw[1].print(" NO CACHE");
985+ } else {
986+ pw[1].print(" CACHE " + cacheSz);
987+ }
988+ if (cycFg.equals("N")){
989+ pw[1].print(" NO CYCLE");
990+ } else {
991+ pw[1].print(" CYCLE");
992+ }
979993 }
980994 pw[1].println(cp.SQL_TERMINATOR[cp.dbType]);
981995 pw[2].println("DROP SEQUENCE " + DB_SQL_QUOTED_S[cp.dbType]+ seqName + DB_SQL_QUOTED_E[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
@@ -1000,10 +1014,14 @@ public class RapideMetaUnloader{
10001014 dbLnk = strSplit[0][3];
10011015
10021016 pw[1].print("CREATE SYNONYM " + DB_SQL_QUOTED_S[cp.dbType]+ synmName + DB_SQL_QUOTED_E[cp.dbType]+ " FOR ");
1003- if(dbLnk.equals("")){
1004- 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]);
1005- } else {
1006- 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]);
1017+ if(cp.dbType == cp.DB_TYPE_ORACLE){
1018+ 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]);
1020+ } 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]);
1022+ }
1023+ } else if(cp.dbType == cp.DB_TYPE_SQLSERVER){
1024+ pw[1].print(tbName);
10071025 }
10081026 pw[1].println(cp.SQL_TERMINATOR[cp.dbType]);
10091027 pw[2].println("DROP SYNONYM " + DB_SQL_QUOTED_S[cp.dbType]+ synmName + DB_SQL_QUOTED_E[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
@@ -1026,7 +1044,6 @@ public class RapideMetaUnloader{
10261044 fkCol = "";
10271045 fkColPos = "";
10281046 rtbName = "";
1029- rfkName = "";
10301047 rfkCol = "";
10311048 rfkColPos = "";
10321049
@@ -1041,9 +1058,8 @@ public class RapideMetaUnloader{
10411058 fkCol = strSplit[0][2];
10421059 fkColPos = strSplit[0][3];
10431060 rtbName = strSplit[0][4];
1044- rfkName = strSplit[0][5];
1045- rfkCol = strSplit[0][6];
1046- rfkColPos = strSplit[0][7];
1061+ rfkCol = strSplit[0][5];
1062+ rfkColPos = strSplit[0][6];
10471063 } else {
10481064 if(fkName.equals("")){
10491065 tbName = strSplit[0][0];
@@ -1051,13 +1067,15 @@ public class RapideMetaUnloader{
10511067 fkCol = strSplit[0][2];
10521068 fkColPos = strSplit[0][3];
10531069 rtbName = strSplit[0][4];
1054- rfkName = strSplit[0][5];
1055- rfkCol = strSplit[0][6];
1056- rfkColPos = strSplit[0][7];
1070+ rfkCol = strSplit[0][5];
1071+ rfkColPos = strSplit[0][6];
10571072 } else {
1058- if (strSplit[0][3].equals(strSplit[0][7])) {
1073+ if (
1074+ (cp.dbType == cp.DB_TYPE_ORACLE && strSplit[0][3].equals(strSplit[0][6])) ||
1075+ cp.dbType != cp.DB_TYPE_ORACLE
1076+ ) {
10591077 fkCol = fkCol + DB_SQL_QUOTED_E[cp.dbType]+ ", " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][2];
1060- rfkCol = rfkCol + DB_SQL_QUOTED_E[cp.dbType]+ ", " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][6];
1078+ rfkCol = rfkCol + DB_SQL_QUOTED_E[cp.dbType]+ ", " + DB_SQL_QUOTED_S[cp.dbType]+ strSplit[0][5];
10611079 }
10621080 }
10631081 }
@@ -1073,7 +1091,7 @@ public class RapideMetaUnloader{
10731091 // Fk Contents end
10741092
10751093 // Rhysical Contents start
1076- if(cp.isPhysical){
1094+ if(cp.isPhysical && cp.dbType == cp.DB_TYPE_ORACLE){
10771095 // physical index setting
10781096 br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[TYPE_OBJ] + "_" + database + "." + cp.fileExtension));
10791097 br[1] = new BufferedReader(new FileReader(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY]));
Show on old repository browser