• R/O
  • HTTP
  • SSH
  • HTTPS

rapideact: Commit


Commit MetaInfo

Revision3a47aecfffe57532d787fc9fd73676162b16cc02 (tree)
Time2017-06-03 18:05:05
Authorkuboryu <kuboryu@yaho...>
Commiterkuboryu

Log Message

20170603

Change Summary

Incremental Difference

--- a/com/rapide_act/CmnProps.java
+++ b/com/rapide_act/CmnProps.java
@@ -77,11 +77,12 @@ public class CmnProps{
7777 protected static final int D_SQLQUOTEDE = 29;
7878 protected static final int D_PHYSICAL = 30;
7979 protected static final int D_DROP = 31;
80- protected static final int KEYS = 32;
80+ protected static final int D_METAFOLDER = 32;
81+ protected static final int KEYS = 33;
8182 protected static final String [] PROP_KEY = { "us","pw","url","dr","out","in","ls","ils","fe","nm",
8283 "dm","ts","tks","od","qt","bc","it","et","ic","ec",
8384 "icm","ecm","smc","dmc","mp","pf","sp","ext","sqs","sqe",
84- "ph", "dp"};
85+ "ph", "dp", "mf"};
8586
8687 protected String [] prop_val = new String[KEYS];
8788 protected static final String [] MASK_PTN = {"ALL", "ALT", "EDGE"};
@@ -116,7 +117,7 @@ public class CmnProps{
116117 protected static final int TYPE_SYNONYM = 5;
117118 protected static final int TYPE_OBJ = 6;
118119 protected static final int TYPE_FK = 7;
119- protected static final String [] FILE_NAME = {
120+ protected static final String [] WK_FILE_NAME = {
120121 "TABLEDEF",
121122 "INDEXDEF",
122123 "VIEWDEF",
@@ -727,6 +728,7 @@ public class CmnProps{
727728 protected char singleByteMaskChar = '*';
728729 protected char doubleByteMaskChar = '\u25A0';
729730 protected String maskPattern = "ALT";
731+ protected String metaFolder = "DDL";
730732
731733 protected String [] inclTablesArray = null;
732734 protected String [] exclTablesArray = null;
@@ -833,6 +835,7 @@ public class CmnProps{
833835 if(!CmnUtils.isEmpty(prop_val[D_SBYTEMASKCHR]))singleByteMaskChar = prop_val[D_SBYTEMASKCHR].charAt(0);
834836 if(!CmnUtils.isEmpty(prop_val[D_DBYTEMASKCHR]))doubleByteMaskChar = prop_val[D_DBYTEMASKCHR].charAt(0);
835837 if(!CmnUtils.isEmpty(prop_val[D_MASKPTN]))maskPattern = prop_val[D_MASKPTN];
838+ if(!CmnUtils.isEmpty(prop_val[D_METAFOLDER]))metaFolder = prop_val[D_METAFOLDER];
836839 if(!CmnUtils.isEmpty(prop_val[D_SPCPADDING]) && prop_val[D_SPCPADDING].toUpperCase().equals("Y"))isSpcPadding = true;
837840 if(!CmnUtils.isEmpty(prop_val[D_FILEEXT]))fileExtension = prop_val[D_FILEEXT];
838841
--- a/com/rapide_act/RapideMetaUnloader.java
+++ b/com/rapide_act/RapideMetaUnloader.java
@@ -28,7 +28,41 @@ import java.sql.Clob;
2828
2929 public class RapideMetaUnloader{
3030
31+ private static final int CONTENTS = 0;
32+ private static final int CREATE = 1;
33+ private static final int DROP = 2;
34+ private static final int TRUNCATE = 3;
3135
36+ private static final int WK_FILE = 0;
37+ private static final int R_CREATE_PKEY = 1;
38+ private static final int R_CREATE_UKEY = 2;
39+ private static final int R_CREATE_INDEX = 3;
40+ private static final int W_CREATE_PKEY = 0;
41+ private static final int W_CREATE_UKEY = 1;
42+ private static final int W_CREATE_INDEX = 2;
43+ private static final int W_DROP_PKEY = 3;
44+ private static final int W_DROP_UKEY = 4;
45+ private static final int W_DROP_INDEX = 5;
46+
47+ private static final int LINE = 0;
48+ private static final int TBL_CONTENTS = 1;
49+ private static final int TBL_COMMENTS = 2;
50+ private static final int IDX_CONTENTS_1 = 1;
51+ private static final int IDX_CONTENTS_2 = 2;
52+ private static final int IDX_CONTENTS_3 = 3;
53+
54+ private static final int COL01 = 0;
55+ private static final int COL02 = 1;
56+ private static final int COL03 = 2;
57+ private static final int COL04 = 3;
58+ private static final int COL05 = 4;
59+ private static final int COL06 = 5;
60+ private static final int COL07 = 6;
61+ private static final int COL08 = 7;
62+ private static final int COL09 = 8;
63+ private static final int COL10 = 9;
64+ private static final int COL11 = 10;
65+ private static final int COL12 = 11;
3266
3367 private String database = null;
3468 private String phyfileExtension = "phy";
@@ -142,9 +176,9 @@ public class RapideMetaUnloader{
142176 folder = new File(cp.outFolder);
143177 } else {
144178 if(database != null){
145- folder = new File(cp.DEFAULT_OUT_FOLDER + "/DDL_" + database.toUpperCase() + "_" + CmnUtils.getYmdhm());
179+ folder = new File(cp.DEFAULT_OUT_FOLDER + "/" + cp.metaFolder + "_" + database.toUpperCase() + "_" + CmnUtils.getYmdhm());
146180 } else {
147- folder = new File(cp.DEFAULT_OUT_FOLDER + "/DDL_" + cp.DB_TYPE_NAME[cp.dbType].toUpperCase() + "_" + CmnUtils.getYmdhm());
181+ folder = new File(cp.DEFAULT_OUT_FOLDER + "/" + cp.metaFolder + "_" + cp.DB_TYPE_NAME[cp.dbType].toUpperCase() + "_" + CmnUtils.getYmdhm());
148182 }
149183 folder.mkdir();
150184 }
@@ -158,17 +192,17 @@ public class RapideMetaUnloader{
158192 // Def tsv Writing start
159193 for(int i=0;i<cp.meta_sql[cp.dbType].length;i++){
160194 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);
195+ CmnUtils.writeSeparator(folder + "/" + cp.WK_FILE_NAME[i] + "_" + database +"." + cp.fileExtension, dao.getColumnCount(), dao.getArrayList(), cp.delimiter);
162196 }
163197 // Def tsv Writing end
164198
165199 // Table Contents start
166- br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_TABLE] + "_" + database + "." + cp.fileExtension));
200+ br[WK_FILE] = new BufferedReader(new FileReader(folder + "/" + cp.WK_FILE_NAME[cp.TYPE_TABLE] + "_" + database + "." + cp.fileExtension));
167201 subFolder = new File(folder + "/TABLES");
168202 subFolder.mkdir();
169- pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_TABLE]))));
170- pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_TABLE]))));
171- pw[3] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.TRUNCATE_TABLE]))));
203+ pw[CREATE] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_TABLE]))));
204+ pw[DROP] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_TABLE]))));
205+ pw[TRUNCATE] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.TRUNCATE_TABLE]))));
172206
173207 tableName = "";
174208 tableCmnt = "";
@@ -183,9 +217,9 @@ public class RapideMetaUnloader{
183217
184218 StringBuffer sbTbCnts = new StringBuffer();
185219 StringBuffer sbTbCmnt = new StringBuffer();
186- while((strLine=br[0].readLine()) != null){
220+ while((strLine=br[WK_FILE].readLine()) != null){
187221 if(!strLine.equals("")){
188- strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
222+ strSplit[LINE] = CmnUtils.split(strLine, cp.delimiter);
189223 if (!tableName.equals("")){
190224 sbTbCnts.append(" " + cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
191225 sbTbCnts.append(" " + colType);
@@ -215,62 +249,64 @@ public class RapideMetaUnloader{
215249 } else {
216250 sbTbCnts.append(" NULL");
217251 }
218- if (!strSplit[0][0].equals(tableName)){
219- pw[1].println(cp.SQL_PREFIX[cp.dbType] + "TABLES/" + tableName + ".sql");
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]);
252+ if (!strSplit[LINE][COL01].equals(tableName)){
253+ pw[CREATE].println(cp.SQL_PREFIX[cp.dbType] + "TABLES/" + tableName + ".sql");
254+ pw[DROP].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]);
255+ pw[TRUNCATE].println("TRUNCATE TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tableName + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
222256 sbTbCnts.append(cp.lineSeparator);
223257 sbTbCnts.append(")" + cp.SQL_TERMINATOR[cp.dbType]);
224258 sbTbCnts.append(cp.lineSeparator);
225- pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + tableName + ".sql"))));
226- strSplit[1] = CmnUtils.split(sbTbCnts.toString(), cp.lineSeparator);
227- for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[0].println(strSplit[1][i]);
228- strSplit[2] = CmnUtils.split(sbTbCmnt.toString(), cp.lineSeparator);
229- for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[0].println(strSplit[2][i]);
230- pw[0].close();
231- pw[0] = null;
259+ pw[CONTENTS] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + tableName + ".sql"))));
260+ strSplit[TBL_CONTENTS] = CmnUtils.split(sbTbCnts.toString(), cp.lineSeparator);
261+ for(int i=0;i<strSplit[TBL_CONTENTS].length;i++)if(!strSplit[TBL_CONTENTS][i].trim().equals(""))pw[CONTENTS].println(strSplit[TBL_CONTENTS][i]);
262+ strSplit[TBL_COMMENTS] = CmnUtils.split(sbTbCmnt.toString(), cp.lineSeparator);
263+ for(int i=0;i<strSplit[TBL_COMMENTS].length;i++)if(!strSplit[TBL_COMMENTS][i].trim().equals(""))pw[CONTENTS].println(strSplit[TBL_COMMENTS][i]);
264+ pw[CONTENTS].close();
265+ pw[CONTENTS] = null;
232266 CmnUtils.infoPrint(String.format("%1$-30s",tableName) + " メタデータがアンロードされました。");
233267 sbTbCnts = new StringBuffer();
234268 sbTbCmnt = new StringBuffer();
235- sbTbCnts.append("CREATE TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]);
269+ sbTbCnts.append("CREATE TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL01] + cp.DB_SQL_QUOTEDE[cp.dbType]);
236270 sbTbCnts.append(cp.lineSeparator);
237271 sbTbCnts.append("(");
238272 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);
273+ if(!strSplit[LINE][COL02].equals(""))sbTbCmnt.append(commentOnTable(cp, strSplit[LINE][COL01], strSplit[LINE][COL02], cp.TYPE_TABLE));
274+ if(!strSplit[LINE][COL02].equals(""))sbTbCmnt.append(cp.lineSeparator);
241275 } else {
242276 sbTbCnts.append(",");
243277 sbTbCnts.append(cp.lineSeparator);
244278 }
245279 }
246280 else {
247- sbTbCnts.append("CREATE TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]);
281+ sbTbCnts.append("CREATE TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL01] + cp.DB_SQL_QUOTEDE[cp.dbType]);
248282 sbTbCnts.append(cp.lineSeparator);
249283 sbTbCnts.append("(");
250284 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);
285+ if(!strSplit[LINE][COL02].equals(""))sbTbCmnt.append(commentOnTable(cp, strSplit[LINE][COL01], strSplit[LINE][COL02], cp.TYPE_TABLE));
286+ if(!strSplit[LINE][COL02].equals(""))sbTbCmnt.append(cp.lineSeparator);
253287 }
254- for(int i=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
255-
256- tableName = strSplit[0][0];
257- tableCmnt = strSplit[0][1];
258- colName = strSplit[0][2];
259- colCmnt = strSplit[0][3];
260- colType = strSplit[0][4];
261- colLen = strSplit[0][5];
262- colPrec = strSplit[0][6];
263- colScale = strSplit[0][7];
264- colNoN = strSplit[0][8];
265- colDflt = strSplit[0][9];
288+ for(int i=0;i<strSplit[LINE].length;i++)CmnUtils.debugPrint("'" + strSplit[LINE][i] + "'");
289+
290+ tableName = strSplit[LINE][COL01];
291+ tableCmnt = strSplit[LINE][COL02];
292+ colName = strSplit[LINE][COL03];
293+ colCmnt = strSplit[LINE][COL04];
294+ colType = strSplit[LINE][COL05];
295+ colLen = strSplit[LINE][COL06];
296+ colPrec = strSplit[LINE][COL07];
297+ colScale = strSplit[LINE][COL08];
298+ colNoN = strSplit[LINE][COL09];
299+ colDflt = strSplit[LINE][COL10];
266300 }
267301 }
268302
269303 if (!tableName.equals("")){
270304 sbTbCnts.append(" " + cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
271305 sbTbCnts.append(" " + colType);
272- if(!colCmnt.equals(""))sbTbCmnt.append(commentOnColumn(cp, tableName, colName, colCmnt, cp.TYPE_TABLE));
273- if(!colCmnt.equals(""))sbTbCmnt.append(cp.lineSeparator);
306+ if(!colCmnt.equals("")){
307+ sbTbCmnt.append(commentOnColumn(cp, tableName, colName, colCmnt, cp.TYPE_TABLE));
308+ sbTbCmnt.append(cp.lineSeparator);
309+ }
274310 if(CmnUtils.isColPrec(colType, colPrec)){
275311 sbTbCnts.append("(" + colPrec);
276312 if (!colScale.equals("") && !colScale.equals("0"))sbTbCnts.append("," + colScale);
@@ -288,35 +324,39 @@ public class RapideMetaUnloader{
288324 } else {
289325 sbTbCnts.append(" NULL");
290326 }
291- pw[1].println(cp.SQL_PREFIX[cp.dbType] + "TABLES/" + tableName + ".sql");
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]);
327+ pw[CREATE].println(cp.SQL_PREFIX[cp.dbType] + "TABLES/" + tableName + ".sql");
328+ pw[DROP].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]);
329+ pw[TRUNCATE].println("TRUNCATE TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tableName + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
294330 sbTbCnts.append(cp.lineSeparator);
295331 sbTbCnts.append(")" + cp.SQL_TERMINATOR[cp.dbType]);
296332 sbTbCnts.append(cp.lineSeparator);
297- pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + tableName + ".sql"))));
298- strSplit[1] = CmnUtils.split(sbTbCnts.toString(), cp.lineSeparator);
299- for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[0].println(strSplit[1][i]);
300- strSplit[2] = CmnUtils.split(sbTbCmnt.toString(), cp.lineSeparator);
301- for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[0].println(strSplit[2][i]);
302- pw[0].close();
303- pw[0] = null;
333+ pw[CONTENTS] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + tableName + ".sql"))));
334+ strSplit[TBL_CONTENTS] = CmnUtils.split(sbTbCnts.toString(), cp.lineSeparator);
335+ for(int i=0;i<strSplit[TBL_CONTENTS].length;i++)if(!strSplit[TBL_CONTENTS][i].trim().equals(""))pw[CONTENTS].println(strSplit[TBL_CONTENTS][i]);
336+ strSplit[TBL_COMMENTS] = CmnUtils.split(sbTbCmnt.toString(), cp.lineSeparator);
337+ for(int i=0;i<strSplit[TBL_COMMENTS].length;i++)if(!strSplit[TBL_COMMENTS][i].trim().equals(""))pw[CONTENTS].println(strSplit[TBL_COMMENTS][i]);
338+ pw[CONTENTS].close();
339+ pw[CONTENTS] = null;
304340 CmnUtils.infoPrint(String.format("%1$-30s",tableName) + " メタデータがアンロードされました。");
305341 }
306- for(int i=1;i<4;i++)pw[i].close();
307- for(int i=1;i<4;i++)pw[i]=null;
308- br[0].close();
309- br[0] = null;
342+ for(int i=0;i<pw.length;i++){
343+ if(pw[i]!=null){
344+ pw[i].close();
345+ pw[i]=null;
346+ }
347+ }
348+ br[WK_FILE].close();
349+ br[WK_FILE] = null;
310350 // Table Contents end
311351
312352 // Index Contents start
313- br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_INDEX] + "_" + database + "." + cp.fileExtension));
314- pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY]))));
315- pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY]))));
316- pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX]))));
317- pw[3] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_PKEY]))));
318- pw[4] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_UKEY]))));
319- pw[5] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_INDEX]))));
353+ br[WK_FILE] = new BufferedReader(new FileReader(folder + "/" + cp.WK_FILE_NAME[cp.TYPE_INDEX] + "_" + database + "." + cp.fileExtension));
354+ pw[W_CREATE_PKEY] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY]))));
355+ pw[W_CREATE_UKEY] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY]))));
356+ pw[W_CREATE_INDEX] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX]))));
357+ pw[W_DROP_PKEY] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_PKEY]))));
358+ pw[W_DROP_UKEY] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_UKEY]))));
359+ pw[W_DROP_INDEX] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_INDEX]))));
320360
321361 //Initial Process
322362 tableName = "";
@@ -330,12 +370,12 @@ public class RapideMetaUnloader{
330370 StringBuffer sbIx3Cnts = new StringBuffer();
331371
332372 //Loop Process
333- while((strLine=br[0].readLine()) != null){
373+ while((strLine=br[WK_FILE].readLine()) != null){
334374 if(!strLine.equals("")){
335- strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
375+ strSplit[LINE] = CmnUtils.split(strLine, cp.delimiter);
336376 //Not 1st Line Process
337377 if (!indexName.equals("")){
338- if (!strSplit[0][1].equals(indexName)){
378+ if (!strSplit[LINE][COL02].equals(indexName)){
339379 //Post Process
340380 if (colPos.equals("1")){
341381 sbIxCnts.append(cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
@@ -352,21 +392,21 @@ public class RapideMetaUnloader{
352392
353393 //Write Buffer
354394 if (constraintType.equals("P")){
355- strSplit[1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
356- for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[0].println(strSplit[1][i]);
357- strSplit[2] = CmnUtils.split(sbIx2Cnts.toString(), cp.lineSeparator);
358- for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[3].println(strSplit[2][i]);
395+ strSplit[IDX_CONTENTS_1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
396+ for(int i=0;i<strSplit[IDX_CONTENTS_1].length;i++)if(!strSplit[IDX_CONTENTS_1][i].trim().equals(""))pw[W_CREATE_PKEY].println(strSplit[IDX_CONTENTS_1][i]);
397+ strSplit[IDX_CONTENTS_2] = CmnUtils.split(sbIx2Cnts.toString(), cp.lineSeparator);
398+ for(int i=0;i<strSplit[IDX_CONTENTS_2].length;i++)if(!strSplit[IDX_CONTENTS_2][i].trim().equals(""))pw[W_DROP_PKEY].println(strSplit[IDX_CONTENTS_2][i]);
359399 } else if (constraintType.equals("U")){
360- strSplit[1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
361- for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[1].println(strSplit[1][i]);
362- strSplit[2] = CmnUtils.split(sbIx2Cnts.toString(), cp.lineSeparator);
363- for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[4].println(strSplit[2][i]);
400+ strSplit[IDX_CONTENTS_1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
401+ for(int i=0;i<strSplit[IDX_CONTENTS_1].length;i++)if(!strSplit[IDX_CONTENTS_1][i].trim().equals(""))pw[W_CREATE_UKEY].println(strSplit[IDX_CONTENTS_1][i]);
402+ strSplit[IDX_CONTENTS_2] = CmnUtils.split(sbIx2Cnts.toString(), cp.lineSeparator);
403+ for(int i=0;i<strSplit[IDX_CONTENTS_2].length;i++)if(!strSplit[IDX_CONTENTS_2][i].trim().equals(""))pw[W_DROP_UKEY].println(strSplit[IDX_CONTENTS_2][i]);
364404 } else if (constraintType.equals("")){
365- strSplit[1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
366- for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[2].println(strSplit[1][i]);
405+ strSplit[IDX_CONTENTS_1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
406+ for(int i=0;i<strSplit[IDX_CONTENTS_1].length;i++)if(!strSplit[IDX_CONTENTS_1][i].trim().equals(""))pw[W_CREATE_INDEX].println(strSplit[IDX_CONTENTS_1][i]);
367407 }
368- strSplit[3] = CmnUtils.split(sbIx3Cnts.toString(), cp.lineSeparator);
369- for(int i=0;i<strSplit[3].length;i++)if(!strSplit[3][i].trim().equals(""))pw[5].println(strSplit[3][i]);
408+ strSplit[IDX_CONTENTS_3] = CmnUtils.split(sbIx3Cnts.toString(), cp.lineSeparator);
409+ for(int i=0;i<strSplit[IDX_CONTENTS_3].length;i++)if(!strSplit[IDX_CONTENTS_3][i].trim().equals(""))pw[W_DROP_INDEX].println(strSplit[IDX_CONTENTS_3][i]);
370410
371411 //Initial Process
372412 sbIxCnts = new StringBuffer();
@@ -374,17 +414,17 @@ public class RapideMetaUnloader{
374414 sbIx3Cnts = new StringBuffer();
375415
376416 //Index Changed Process
377- if (strSplit[0][3].equals("P")){
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]);
380- } else if (strSplit[0][3].equals("U")){
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(");
383- } else if (strSplit[0][3].equals("")){
384- sbIxCnts.append("CREATE INDEX " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][1] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ON " + strSplit[0][0] + "(");
417+ if (strSplit[LINE][COL04].equals("P")){
418+ sbIxCnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL01] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ADD CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL02] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " PRIMARY KEY(");
419+ sbIx2Cnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL01] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " DROP CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL02] + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
420+ } else if (strSplit[LINE][COL04].equals("U")){
421+ sbIxCnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL01] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ADD CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL02] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " UNIQUE(");
422+ sbIx2Cnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL01] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " DROP UNIQUE(");
423+ } else if (strSplit[LINE][COL04].equals("")){
424+ sbIxCnts.append("CREATE INDEX " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL02] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ON " + strSplit[LINE][COL01] + "(");
385425 }
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]);
387- } else if (strSplit[0][1].equals(indexName)){
426+ sbIx3Cnts.append("DROP INDEX " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL02] + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
427+ } else if (strSplit[LINE][COL02].equals(indexName)){
388428 if (colPos.equals("1")){
389429 sbIxCnts.append(cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
390430 if (constraintType.equals("U"))sbIx2Cnts.append(cp.DB_SQL_QUOTEDS[cp.dbType]+ colName + cp.DB_SQL_QUOTEDE[cp.dbType]);
@@ -397,25 +437,25 @@ public class RapideMetaUnloader{
397437
398438 //1st Line Process
399439 else {
400- if (strSplit[0][3].equals("P")){
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]);
403- } else if (strSplit[0][3].equals("U")){
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(");
406- } else if (strSplit[0][3].equals("")){
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]+ "(");
440+ if (strSplit[LINE][COL04].equals("P")){
441+ sbIxCnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL01] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ADD CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL02] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " PRIMARY KEY(");
442+ sbIx2Cnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL01] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " DROP CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL02] + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
443+ } else if (strSplit[LINE][COL04].equals("U")){
444+ sbIxCnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL01] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ADD CONSTRAINT " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL02] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " UNIQUE(");
445+ sbIx2Cnts.append("ALTER TABLE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL01] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " DROP UNIQUE(");
446+ } else if (strSplit[LINE][COL04].equals("")){
447+ sbIxCnts.append("CREATE INDEX " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL02] + cp.DB_SQL_QUOTEDE[cp.dbType]+ " ON " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL01] + cp.DB_SQL_QUOTEDE[cp.dbType]+ "(");
408448 }
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]);
449+ sbIx3Cnts.append("DROP INDEX " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL02] + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
410450 }
411- for(int i=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
451+ for(int i=0;i<strSplit[LINE].length;i++)CmnUtils.debugPrint("'" + strSplit[LINE][i] + "'");
412452
413- tableName = strSplit[0][0];
414- indexName = strSplit[0][1];
415- indexType = strSplit[0][2];
416- constraintType = strSplit[0][3];
417- colName = strSplit[0][4];
418- colPos = strSplit[0][5];
453+ tableName = strSplit[LINE][COL01];
454+ indexName = strSplit[LINE][COL02];
455+ indexType = strSplit[LINE][COL03];
456+ constraintType = strSplit[LINE][COL04];
457+ colName = strSplit[LINE][COL05];
458+ colPos = strSplit[LINE][COL06];
419459 }
420460 }
421461 if (!indexName.equals("")){
@@ -435,228 +475,248 @@ public class RapideMetaUnloader{
435475
436476 //Write Buffer
437477 if (constraintType.equals("P")){
438- strSplit[1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
439- for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[0].println(strSplit[1][i]);
440- strSplit[2] = CmnUtils.split(sbIx2Cnts.toString(), cp.lineSeparator);
441- for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[3].println(strSplit[2][i]);
478+ strSplit[IDX_CONTENTS_1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
479+ for(int i=0;i<strSplit[IDX_CONTENTS_1].length;i++)if(!strSplit[IDX_CONTENTS_1][i].trim().equals(""))pw[W_CREATE_PKEY].println(strSplit[IDX_CONTENTS_1][i]);
480+ strSplit[IDX_CONTENTS_2] = CmnUtils.split(sbIx2Cnts.toString(), cp.lineSeparator);
481+ for(int i=0;i<strSplit[IDX_CONTENTS_2].length;i++)if(!strSplit[IDX_CONTENTS_2][i].trim().equals(""))pw[W_DROP_PKEY].println(strSplit[IDX_CONTENTS_2][i]);
442482 } else if (constraintType.equals("U")){
443- strSplit[1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
444- for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[1].println(strSplit[1][i]);
445- strSplit[2] = CmnUtils.split(sbIx2Cnts.toString(), cp.lineSeparator);
446- for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[4].println(strSplit[2][i]);
483+ strSplit[IDX_CONTENTS_1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
484+ for(int i=0;i<strSplit[IDX_CONTENTS_1].length;i++)if(!strSplit[IDX_CONTENTS_1][i].trim().equals(""))pw[W_CREATE_UKEY].println(strSplit[IDX_CONTENTS_1][i]);
485+ strSplit[IDX_CONTENTS_2] = CmnUtils.split(sbIx2Cnts.toString(), cp.lineSeparator);
486+ for(int i=0;i<strSplit[IDX_CONTENTS_2].length;i++)if(!strSplit[IDX_CONTENTS_2][i].trim().equals(""))pw[W_DROP_UKEY].println(strSplit[IDX_CONTENTS_2][i]);
447487 } else if (constraintType.equals("")){
448- strSplit[1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
449- for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[2].println(strSplit[1][i]);
488+ strSplit[IDX_CONTENTS_1] = CmnUtils.split(sbIxCnts.toString(), cp.lineSeparator);
489+ for(int i=0;i<strSplit[IDX_CONTENTS_1].length;i++)if(!strSplit[IDX_CONTENTS_1][i].trim().equals(""))pw[W_CREATE_INDEX].println(strSplit[IDX_CONTENTS_1][i]);
450490 }
451- strSplit[3] = CmnUtils.split(sbIx3Cnts.toString(), cp.lineSeparator);
452- for(int i=0;i<strSplit[3].length;i++)if(!strSplit[3][i].trim().equals(""))pw[5].println(strSplit[3][i]);
491+ strSplit[IDX_CONTENTS_3] = CmnUtils.split(sbIx3Cnts.toString(), cp.lineSeparator);
492+ for(int i=0;i<strSplit[IDX_CONTENTS_3].length;i++)if(!strSplit[IDX_CONTENTS_3][i].trim().equals(""))pw[W_DROP_INDEX].println(strSplit[IDX_CONTENTS_3][i]);
453493 }
454494
455495 //Close Buffer
456- for(int i=0;i<6;i++)pw[i].close();
457- for(int i=0;i<6;i++)pw[i]=null;
458- br[0].close();
459- br[0] = null;
496+ for(int i=0;i<pw.length;i++){
497+ if(pw[i]!=null){
498+ pw[i].close();
499+ pw[i]=null;
500+ }
501+ }
502+ br[WK_FILE].close();
503+ br[WK_FILE] = null;
460504 // Index Contents end
461505
462506 // View Contents start
463- br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_VIEW] + "_" + database + "." + cp.fileExtension));
507+ br[WK_FILE] = new BufferedReader(new FileReader(folder + "/" + cp.WK_FILE_NAME[cp.TYPE_VIEW] + "_" + database + "." + cp.fileExtension));
464508 subFolder = new File(folder + "/VIEWS");
465509 subFolder.mkdir();
466- pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_VIEW]))));
467- pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_VIEW]))));
468- while((strLine=br[0].readLine()) != null){
469- strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
470- CmnUtils.debugPrint("'" + strSplit[0][0] + "'");
471- pw[1].println(cp.SQL_PREFIX[cp.dbType] + "VIEWS/" + strSplit[0][0] + ".sql");
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]);
473- if (strSplit[0].length>1)CmnUtils.debugPrint("'" + strSplit[0][1] + "'");
474- pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + strSplit[0][0] + ".sql"))));
510+ pw[CREATE] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_VIEW]))));
511+ pw[DROP] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_VIEW]))));
512+ while((strLine=br[WK_FILE].readLine()) != null){
513+ strSplit[LINE] = CmnUtils.split(strLine, cp.delimiter);
514+ CmnUtils.debugPrint("'" + strSplit[LINE][COL01] + "'");
515+ pw[CREATE].println(cp.SQL_PREFIX[cp.dbType] + "VIEWS/" + strSplit[LINE][COL01] + ".sql");
516+ pw[DROP].println("DROP VIEW " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL01] + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
517+ if (strSplit[LINE].length>1)CmnUtils.debugPrint("'" + strSplit[LINE][COL02] + "'");
518+ pw[CONTENTS] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + strSplit[LINE][COL01] + ".sql"))));
475519
476520 stmt = dao.prepareSql(cp.sql_view_column_and_comment[cp.dbType]);
477- stmt.setString(1,strSplit[0][0]);
521+ stmt.setString(1,strSplit[LINE][COL01]);
478522 dao.executeSql();
479523 alData = dao.getArrayList();
480524 columnCount = dao.getColumnCount();
481525 if (cp.dbType == cp.DB_TYPE_ORACLE){
482- pw[0].println("/* " + strSplit[0][0] + " */");
483- pw[0].println("CREATE OR REPLACE VIEW " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[0][0] + cp.DB_SQL_QUOTEDE[cp.dbType]);
484- pw[0].println("(");
526+ pw[CONTENTS].println("/* " + strSplit[LINE][COL01] + " */");
527+ pw[CONTENTS].println("CREATE OR REPLACE VIEW " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL01] + cp.DB_SQL_QUOTEDE[cp.dbType]);
528+ pw[CONTENTS].println("(");
485529 for(int i=0;i<alData.size();i++){
486530 if ((i+1) % columnCount == 1){
487531 if (i == 0){
488532 if (!alData.get(i+1).trim().equals("")){
489- pw[0].println(" " + cp.DB_SQL_QUOTEDS[cp.dbType]+ alData.get(i) + cp.DB_SQL_QUOTEDE[cp.dbType]+ " -- " + alData.get(i+1));
533+ pw[CONTENTS].println(" " + cp.DB_SQL_QUOTEDS[cp.dbType]+ alData.get(i) + cp.DB_SQL_QUOTEDE[cp.dbType]+ " -- " + alData.get(i+1));
490534 } else {
491- pw[0].println(" " + cp.DB_SQL_QUOTEDS[cp.dbType]+ alData.get(i) + cp.DB_SQL_QUOTEDE[cp.dbType]);
535+ pw[CONTENTS].println(" " + cp.DB_SQL_QUOTEDS[cp.dbType]+ alData.get(i) + cp.DB_SQL_QUOTEDE[cp.dbType]);
492536 }
493537 } else {
494538 if (!alData.get(i+1).trim().equals("")){
495- pw[0].println(" ," + cp.DB_SQL_QUOTEDS[cp.dbType]+ alData.get(i) + cp.DB_SQL_QUOTEDE[cp.dbType]+ " -- " + alData.get(i+1));
539+ pw[CONTENTS].println(" ," + cp.DB_SQL_QUOTEDS[cp.dbType]+ alData.get(i) + cp.DB_SQL_QUOTEDE[cp.dbType]+ " -- " + alData.get(i+1));
496540 } else {
497- pw[0].println(" ," + cp.DB_SQL_QUOTEDS[cp.dbType]+ alData.get(i) + cp.DB_SQL_QUOTEDE[cp.dbType]);
541+ pw[CONTENTS].println(" ," + cp.DB_SQL_QUOTEDS[cp.dbType]+ alData.get(i) + cp.DB_SQL_QUOTEDE[cp.dbType]);
498542 }
499543 }
500544 }
501545 }
502- pw[0].println(")");
503- pw[0].println("AS");
546+ pw[CONTENTS].println(")");
547+ pw[CONTENTS].println("AS");
504548 }
505549 stmt = dao.prepareSql(cp.sql_view_text[cp.dbType]);
506- stmt.setString(1,strSplit[0][0]);
550+ stmt.setString(1,strSplit[LINE][COL01]);
507551 dao.executeSql();
508552 alData2 = dao.getArrayList();
509553 strContents = alData2.get(0).trim();
510554 strSplit[1] = CmnUtils.split(strContents, cp.lineSeparator);
511- 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() + "."),""));
512- pw[0].println(cp.SQL_TERMINATOR[cp.dbType]);
555+ for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[CONTENTS].println(strSplit[1][i].replaceAll("\"\"","\"").replaceAll(Pattern.quote(cp.user.toUpperCase() + "."),"").replaceAll(Pattern.quote(cp.user.toLowerCase() + "."),""));
556+ pw[CONTENTS].println(cp.SQL_TERMINATOR[cp.dbType]);
513557
514- if (!strSplit[0][1].trim().equals(""))pw[0].println(commentOnTable(cp, strSplit[0][0], strSplit[0][1], cp.TYPE_VIEW));
558+ if (!strSplit[LINE][COL02].trim().equals(""))pw[CONTENTS].println(commentOnTable(cp, strSplit[LINE][COL01], strSplit[LINE][COL02], cp.TYPE_VIEW));
515559 for(int i=0;i<alData.size();i++){
516560 if ((i+1) % columnCount == 0){
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));
561+ if (!alData.get(i).trim().equals(""))pw[CONTENTS].println(commentOnColumn(cp, strSplit[LINE][COL01], alData.get(i-1), alData.get(i), cp.TYPE_VIEW));
518562 }
519563 }
520- pw[0].close();
521- pw[0] = null;
522- CmnUtils.infoPrint(String.format("%1$-30s",strSplit[0][0]) + " メタデータがアンロードされました。");
564+ pw[CONTENTS].close();
565+ pw[CONTENTS] = null;
566+ CmnUtils.infoPrint(String.format("%1$-30s",strSplit[LINE][COL01]) + " メタデータがアンロードされました。");
567+ }
568+ for(int i=0;i<pw.length;i++){
569+ if(pw[i]!=null){
570+ pw[i].close();
571+ pw[i]=null;
572+ }
523573 }
524- for(int i=1;i<3;i++)pw[i].close();
525- for(int i=1;i<3;i++)pw[i]=null;
526- br[0].close();
527- br[0] = null;
574+ br[WK_FILE].close();
575+ br[WK_FILE] = null;
528576 // View Contents end
529577
530578 // Procedure Contents start
531- br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_PROCEDURE] + "_" + database + "." + cp.fileExtension));
579+ br[WK_FILE] = new BufferedReader(new FileReader(folder + "/" + cp.WK_FILE_NAME[cp.TYPE_PROCEDURE] + "_" + database + "." + cp.fileExtension));
532580 subFolder = new File(folder + "/PROCEDURES");
533581 subFolder.mkdir();
534- pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PROCEDURE]))));
535- pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_PROCEDURE]))));
536- while((strLine=br[0].readLine()) != null){
537- strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
538- CmnUtils.debugPrint("'" + strSplit[0][0] + "'");
539- pw[1].println(cp.SQL_PREFIX[cp.dbType] + "PROCEDURES/" + strSplit[0][0] + ".sql");
540- pw[2].println("DROP " + strSplit[0][1] + " " + strSplit[0][0] + cp.SQL_TERMINATOR[cp.dbType]);
541- if (strSplit[0].length>1)CmnUtils.debugPrint("'" + strSplit[0][1] + "'");
542- pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + strSplit[0][0] + ".sql"))));
582+ pw[CREATE] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PROCEDURE]))));
583+ pw[DROP] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_PROCEDURE]))));
584+ while((strLine=br[WK_FILE].readLine()) != null){
585+ strSplit[LINE] = CmnUtils.split(strLine, cp.delimiter);
586+ CmnUtils.debugPrint("'" + strSplit[LINE][COL01] + "'");
587+ pw[CREATE].println(cp.SQL_PREFIX[cp.dbType] + "PROCEDURES/" + strSplit[LINE][COL01] + ".sql");
588+ pw[DROP].println("DROP " + strSplit[LINE][COL02] + " " + strSplit[LINE][COL01] + cp.SQL_TERMINATOR[cp.dbType]);
589+ if (strSplit[LINE].length>1)CmnUtils.debugPrint("'" + strSplit[LINE][COL02] + "'");
590+ pw[CONTENTS] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + strSplit[LINE][COL01] + ".sql"))));
543591 if (cp.dbType == cp.DB_TYPE_ORACLE){
544- pw[0].println("/* " + strSplit[0][0] + " */");
545- pw[0].print("CREATE OR REPLACE ");
592+ pw[CONTENTS].println("/* " + strSplit[LINE][COL01] + " */");
593+ pw[CONTENTS].print("CREATE OR REPLACE ");
546594 }
547595 stmt = dao.prepareSql(cp.sql_proc[cp.dbType]);
548- stmt.setString(1,strSplit[0][1]);
549- stmt.setString(2,strSplit[0][0]);
596+ stmt.setString(1,strSplit[LINE][COL02]);
597+ stmt.setString(2,strSplit[LINE][COL01]);
550598 dao.executeSql();
551599 alData = dao.getArrayList();
552600 for(int i=0;i<alData.size();i++){
553601 strContents = alData.get(i);
554- if(!strContents.equals(""))pw[0].println(strContents.replaceAll("\"\"","\"").replaceAll(Pattern.quote(cp.user.toUpperCase() + "."),"").replaceAll(Pattern.quote(cp.user.toLowerCase() + "."),""));
602+ if(!strContents.equals(""))pw[CONTENTS].println(strContents.replaceAll("\"\"","\"").replaceAll(Pattern.quote(cp.user.toUpperCase() + "."),"").replaceAll(Pattern.quote(cp.user.toLowerCase() + "."),""));
555603 }
556604
557605 if (cp.dbType == cp.DB_TYPE_SQLSERVER){
558- pw[0].println(cp.SQL_TERMINATOR[cp.dbType]);
559- //pw[0].println("/");
606+ pw[CONTENTS].println(cp.SQL_TERMINATOR[cp.dbType]);
607+ //pw[CONTENTS].println("/");
608+ }
609+ pw[CONTENTS].close();
610+ pw[CONTENTS] = null;
611+ CmnUtils.infoPrint(String.format("%1$-30s",strSplit[LINE][COL01]) + " メタデータがアンロードされました。");
612+ }
613+ for(int i=0;i<pw.length;i++){
614+ if(pw[i]!=null){
615+ pw[i].close();
616+ pw[i]=null;
560617 }
561- pw[0].close();
562- pw[0] = null;
563- CmnUtils.infoPrint(String.format("%1$-30s",strSplit[0][0]) + " メタデータがアンロードされました。");
564618 }
565- for(int i=1;i<3;i++)pw[i].close();
566- for(int i=1;i<3;i++)pw[i]=null;
567- br[0].close();
568- br[0] = null;
619+ br[WK_FILE].close();
620+ br[WK_FILE] = null;
569621 // Procedure Contents end
570622
571623 // Sequence Contents start
572- br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_SEQ] + "_" + database + "." + cp.fileExtension));
573- pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_SEQUENCE]))));
574- pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_SEQUENCE]))));
575-
576- while((strLine=br[0].readLine()) != null){
577- strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
578- seqName = strSplit[0][0];
579- minVal = strSplit[0][1];
580- maxVal = strSplit[0][2];
581- incSz = strSplit[0][3];
582- cycFg = strSplit[0][4];
583- odFg = strSplit[0][5];
584- cacheSz = strSplit[0][6];
624+ br[WK_FILE] = new BufferedReader(new FileReader(folder + "/" + cp.WK_FILE_NAME[cp.TYPE_SEQ] + "_" + database + "." + cp.fileExtension));
625+ pw[CREATE] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_SEQUENCE]))));
626+ pw[DROP] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_SEQUENCE]))));
627+
628+ while((strLine=br[WK_FILE].readLine()) != null){
629+ strSplit[LINE] = CmnUtils.split(strLine, cp.delimiter);
630+ seqName = strSplit[LINE][COL01];
631+ minVal = strSplit[LINE][COL02];
632+ maxVal = strSplit[LINE][COL03];
633+ incSz = strSplit[LINE][COL04];
634+ cycFg = strSplit[LINE][COL05];
635+ odFg = strSplit[LINE][COL06];
636+ cacheSz = strSplit[LINE][COL07];
585637 if(cacheSz.equals("0"))cacheSz="10";
586- lstNo = strSplit[0][7];
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);
638+ lstNo = strSplit[LINE][COL08];
639+ pw[CREATE].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);
588640 if (cp.dbType == cp.DB_TYPE_ORACLE){
589- pw[1].print(" CACHE " + cacheSz);
641+ pw[CREATE].print(" CACHE " + cacheSz);
590642 if (odFg.equals("N")){
591- pw[1].print(" NOORDER");
643+ pw[CREATE].print(" NOORDER");
592644 } else {
593- pw[1].print(" ORDER");
645+ pw[CREATE].print(" ORDER");
594646 }
595647 if (cycFg.equals("N")){
596- pw[1].print(" NOCYCLE");
648+ pw[CREATE].print(" NOCYCLE");
597649 } else {
598- pw[1].print(" CYCLE");
650+ pw[CREATE].print(" CYCLE");
599651 }
600652 } else if (cp.dbType == cp.DB_TYPE_SQLSERVER){
601653 if (cacheSz.equals("")){
602- pw[1].print(" NO CACHE");
654+ pw[CREATE].print(" NO CACHE");
603655 } else {
604- pw[1].print(" CACHE " + cacheSz);
656+ pw[CREATE].print(" CACHE " + cacheSz);
605657 }
606658 if (cycFg.equals("N")){
607- pw[1].print(" NO CYCLE");
659+ pw[CREATE].print(" NO CYCLE");
608660 } else {
609- pw[1].print(" CYCLE");
661+ pw[CREATE].print(" CYCLE");
610662 }
611663 }
612- pw[1].println(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]);
614- for(int i=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
664+ pw[CREATE].println(cp.SQL_TERMINATOR[cp.dbType]);
665+ pw[DROP].println("DROP SEQUENCE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ seqName + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
666+ for(int i=0;i<strSplit[LINE].length;i++)CmnUtils.debugPrint("'" + strSplit[LINE][i] + "'");
615667 }
616- for(int i=1;i<3;i++)pw[i].close();
617- for(int i=1;i<3;i++)pw[i]=null;
618- br[0].close();
619- br[0] = null;
668+ for(int i=0;i<pw.length;i++){
669+ if(pw[i]!=null){
670+ pw[i].close();
671+ pw[i]=null;
672+ }
673+ }
674+ br[WK_FILE].close();
675+ br[WK_FILE] = null;
620676 // Sequence Contents end
621677
622678 // Synonym Contents start
623- br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_SYNONYM] + "_" + database + "." + cp.fileExtension));
624- pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_SYNONYM]))));
625- pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_SYNONYM]))));
626-
627- while((strLine=br[0].readLine()) != null){
628- strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
629- synmName = strSplit[0][0];
630- tbOwner = strSplit[0][1];
631- tbName = strSplit[0][2];
632- dbLnk = strSplit[0][3];
679+ br[WK_FILE] = new BufferedReader(new FileReader(folder + "/" + cp.WK_FILE_NAME[cp.TYPE_SYNONYM] + "_" + database + "." + cp.fileExtension));
680+ pw[CREATE] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_SYNONYM]))));
681+ pw[DROP] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_SYNONYM]))));
682+
683+ while((strLine=br[WK_FILE].readLine()) != null){
684+ strSplit[LINE] = CmnUtils.split(strLine, cp.delimiter);
685+ synmName = strSplit[LINE][COL01];
686+ tbOwner = strSplit[LINE][COL02];
687+ tbName = strSplit[LINE][COL03];
688+ dbLnk = strSplit[LINE][COL04];
633689
634- pw[1].print("CREATE SYNONYM " + cp.DB_SQL_QUOTEDS[cp.dbType]+ synmName + cp.DB_SQL_QUOTEDE[cp.dbType]+ " FOR ");
690+ pw[CREATE].print("CREATE SYNONYM " + cp.DB_SQL_QUOTEDS[cp.dbType]+ synmName + cp.DB_SQL_QUOTEDE[cp.dbType]+ " FOR ");
635691 if(cp.dbType == cp.DB_TYPE_ORACLE){
636692 if(!dbLnk.equals("")){
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]);
693+ pw[CREATE].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]);
638694 } else {
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]);
695+ pw[CREATE].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]);
640696 }
641697 } else if(cp.dbType == cp.DB_TYPE_SQLSERVER){
642- pw[1].print(tbName);
698+ pw[CREATE].print(tbName);
699+ }
700+ pw[CREATE].println(cp.SQL_TERMINATOR[cp.dbType]);
701+ pw[DROP].println("DROP SYNONYM " + cp.DB_SQL_QUOTEDS[cp.dbType]+ synmName + cp.DB_SQL_QUOTEDE[cp.dbType]+ cp.SQL_TERMINATOR[cp.dbType]);
702+ for(int i=0;i<strSplit[LINE].length;i++)CmnUtils.debugPrint("'" + strSplit[LINE][i] + "'");
703+ }
704+ for(int i=0;i<pw.length;i++){
705+ if(pw[i]!=null){
706+ pw[i].close();
707+ pw[i]=null;
643708 }
644- pw[1].println(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]);
646- for(int i=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
647709 }
648- for(int i=1;i<3;i++)pw[i].close();
649- for(int i=1;i<3;i++)pw[i]=null;
650- br[0].close();
651- br[0] = null;
710+ br[WK_FILE].close();
711+ br[WK_FILE] = null;
652712 // Synonym Contents end
653713
654714 // Fk Contents start
655- File tsvFile = new File(folder + "/" + cp.FILE_NAME[cp.TYPE_FK] + "_" + database + "." + cp.fileExtension);
715+ File tsvFile = new File(folder + "/" + cp.WK_FILE_NAME[cp.TYPE_FK] + "_" + database + "." + cp.fileExtension);
656716 if (tsvFile.length() > 0) {
657- br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_FK] + "_" + database + "." + cp.fileExtension));
658- pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_FK]))));
659- pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_FK]))));
717+ br[WK_FILE] = new BufferedReader(new FileReader(folder + "/" + cp.WK_FILE_NAME[cp.TYPE_FK] + "_" + database + "." + cp.fileExtension));
718+ pw[CREATE] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_FK]))));
719+ pw[DROP] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_FK]))));
660720 tbName = "";
661721 fkName = "";
662722 fkCol = "";
@@ -665,189 +725,201 @@ public class RapideMetaUnloader{
665725 rfkCol = "";
666726 rfkColPos = "";
667727
668- while((strLine=br[0].readLine()) != null){
669- strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
670- if(!fkName.equals(strSplit[0][1]) && !fkName.equals("")){
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]);
673- for(int i=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
674- tbName = strSplit[0][0];
675- fkName = strSplit[0][1];
676- fkCol = strSplit[0][2];
677- fkColPos = strSplit[0][3];
678- rtbName = strSplit[0][4];
679- rfkCol = strSplit[0][5];
680- rfkColPos = strSplit[0][6];
728+ while((strLine=br[WK_FILE].readLine()) != null){
729+ strSplit[LINE] = CmnUtils.split(strLine, cp.delimiter);
730+ if(!fkName.equals(strSplit[LINE][COL02]) && !fkName.equals("")){
731+ pw[CREATE].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]);
732+ pw[DROP].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]);
733+ for(int i=0;i<strSplit[LINE].length;i++)CmnUtils.debugPrint("'" + strSplit[LINE][i] + "'");
734+ tbName = strSplit[LINE][COL01];
735+ fkName = strSplit[LINE][COL02];
736+ fkCol = strSplit[LINE][COL03];
737+ fkColPos = strSplit[LINE][COL04];
738+ rtbName = strSplit[LINE][COL05];
739+ rfkCol = strSplit[LINE][COL06];
740+ rfkColPos = strSplit[LINE][COL07];
681741 } else {
682742 if(fkName.equals("")){
683- tbName = strSplit[0][0];
684- fkName = strSplit[0][1];
685- fkCol = strSplit[0][2];
686- fkColPos = strSplit[0][3];
687- rtbName = strSplit[0][4];
688- rfkCol = strSplit[0][5];
689- rfkColPos = strSplit[0][6];
743+ tbName = strSplit[LINE][COL01];
744+ fkName = strSplit[LINE][COL02];
745+ fkCol = strSplit[LINE][COL03];
746+ fkColPos = strSplit[LINE][COL04];
747+ rtbName = strSplit[LINE][COL05];
748+ rfkCol = strSplit[LINE][COL06];
749+ rfkColPos = strSplit[LINE][COL07];
690750 } else {
691751 if (
692- (cp.dbType == cp.DB_TYPE_ORACLE && strSplit[0][3].equals(strSplit[0][6])) ||
752+ (cp.dbType == cp.DB_TYPE_ORACLE && strSplit[LINE][COL04].equals(strSplit[LINE][COL07])) ||
693753 cp.dbType != cp.DB_TYPE_ORACLE
694754 ) {
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];
755+ fkCol = fkCol + cp.DB_SQL_QUOTEDE[cp.dbType]+ ", " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL03];
756+ rfkCol = rfkCol + cp.DB_SQL_QUOTEDE[cp.dbType]+ ", " + cp.DB_SQL_QUOTEDS[cp.dbType]+ strSplit[LINE][COL06];
697757 }
698758 }
699759 }
700760
701761 }
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]);
704- for(int i=1;i<3;i++)pw[i].close();
705- for(int i=1;i<3;i++)pw[i]=null;
706- br[0].close();
707- br[0] = null;
762+ pw[CREATE].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]);
763+ pw[DROP].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]);
764+ for(int i=0;i<pw.length;i++){
765+ if(pw[i]!=null){
766+ pw[i].close();
767+ pw[i]=null;
768+ }
769+ }
770+ br[WK_FILE].close();
771+ br[WK_FILE] = null;
708772 }
709773 // Fk Contents end
710774
711775 // Rhysical Contents start
712776 if(cp.isPhysical && cp.dbType == cp.DB_TYPE_ORACLE){
713777 // physical index setting
714- br[0] = new BufferedReader(new FileReader(folder + "/" + cp.FILE_NAME[cp.TYPE_OBJ] + "_" + database + "." + cp.fileExtension));
715- br[1] = new BufferedReader(new FileReader(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY]));
716- br[2] = new BufferedReader(new FileReader(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY]));
717- br[3] = new BufferedReader(new FileReader(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX]));
718- pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY] + "." + phyfileExtension))));
719- pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY] + "." + phyfileExtension))));
720- pw[3] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX] + "." + phyfileExtension))));
778+ br[WK_FILE] = new BufferedReader(new FileReader(folder + "/" + cp.WK_FILE_NAME[cp.TYPE_OBJ] + "_" + database + "." + cp.fileExtension));
779+ br[R_CREATE_PKEY] = new BufferedReader(new FileReader(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY]));
780+ br[R_CREATE_UKEY] = new BufferedReader(new FileReader(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY]));
781+ br[R_CREATE_INDEX] = new BufferedReader(new FileReader(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX]));
782+ pw[W_CREATE_PKEY] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY] + "." + phyfileExtension))));
783+ pw[W_CREATE_UKEY] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY] + "." + phyfileExtension))));
784+ pw[W_CREATE_INDEX] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX] + "." + phyfileExtension))));
721785 alData = new ArrayList<String>();
722786 int rowNo;
723787 String [] rowData;
724- while((strLine=br[0].readLine()) != null){
725- strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
726- for(int i=0;i<strSplit[0].length;i++)alData.add(strSplit[0][i]);
788+ while((strLine=br[WK_FILE].readLine()) != null){
789+ strSplit[LINE] = CmnUtils.split(strLine, cp.delimiter);
790+ for(int i=0;i<strSplit[LINE].length;i++)alData.add(strSplit[LINE][i]);
727791 }
728- while((strLine=br[1].readLine()) != null){
729- strSplit[0] = CmnUtils.splitSpace(strLine);
730- rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[0][5].replaceAll("\"",""));
792+ while((strLine=br[R_CREATE_PKEY].readLine()) != null){
793+ strSplit[LINE] = CmnUtils.splitSpace(strLine);
794+ rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[LINE][COL06].replaceAll("\"",""));
731795 if (rowNo != -1){
732- rowData = rowData = CmnUtils.getArrayRowData(alData, 12, rowNo);
733- CmnUtils.debugPrint(strSplit[0][5] + ":" + rowNo);
796+ rowData = CmnUtils.getArrayRowData(alData, 12, rowNo);
797+ CmnUtils.debugPrint(strSplit[LINE][COL06] + ":" + rowNo);
734798 for(int i=0;i<rowData.length;i++)CmnUtils.debugPrint(rowData[i]);
735- tbName = rowData[0];
736- objName = rowData[1];
737- objTyp = rowData[2];
738- pctFree = rowData[3];
739- pctUsed = rowData[4];
740- iniTrns = rowData[5];
741- freeLst = rowData[6];
742- flstGrp = rowData[7];
743- bufPool = rowData[8];
744- tblSpace = rowData[9];
745- logging = rowData[10];
746- segByts = rowData[11];
747- pw[1].print(strLine.replace(';',' '));
748- pw[1].print("USING INDEX PCTFREE " + pctFree);
749- pw[1].print(" INITRANS " + iniTrns + " STORAGE(");
750- if(!freeLst.equals(""))pw[1].print(" FREELISTS " + freeLst);
751- if(!flstGrp.equals(""))pw[1].print(" FREELIST GROUPS " + flstGrp);
752- pw[1].print(" BUFFER_POOL " + bufPool + ")");
753- pw[1].print(" TABLESPACE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tblSpace + cp.DB_SQL_QUOTEDE[cp.dbType]);
799+ tbName = rowData[COL01];
800+ objName = rowData[COL02];
801+ objTyp = rowData[COL03];
802+ pctFree = rowData[COL04];
803+ pctUsed = rowData[COL05];
804+ iniTrns = rowData[COL06];
805+ freeLst = rowData[COL07];
806+ flstGrp = rowData[COL08];
807+ bufPool = rowData[COL09];
808+ tblSpace = rowData[COL10];
809+ logging = rowData[COL11];
810+ segByts = rowData[COL12];
811+ pw[W_CREATE_PKEY].print(strLine.replace(';',' '));
812+ pw[W_CREATE_PKEY].print("USING INDEX PCTFREE " + pctFree);
813+ pw[W_CREATE_PKEY].print(" INITRANS " + iniTrns + " STORAGE(");
814+ if(!freeLst.equals(""))pw[W_CREATE_PKEY].print(" FREELISTS " + freeLst);
815+ if(!flstGrp.equals(""))pw[W_CREATE_PKEY].print(" FREELIST GROUPS " + flstGrp);
816+ pw[W_CREATE_PKEY].print(" BUFFER_POOL " + bufPool + ")");
817+ pw[W_CREATE_PKEY].print(" TABLESPACE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tblSpace + cp.DB_SQL_QUOTEDE[cp.dbType]);
754818 if(logging.equals("NO")){
755- pw[1].println(" NOLOGGING" + cp.SQL_TERMINATOR[cp.dbType]);
819+ pw[W_CREATE_PKEY].println(" NOLOGGING" + cp.SQL_TERMINATOR[cp.dbType]);
756820 } else {
757- pw[1].println(cp.SQL_TERMINATOR[cp.dbType]);
821+ pw[W_CREATE_PKEY].println(cp.SQL_TERMINATOR[cp.dbType]);
758822 }
759823 } else {
760- pw[1].println(strLine);
761- CmnUtils.errorPrint(strSplit[0][5] + ",UNUSABLE INDEX");
824+ pw[W_CREATE_PKEY].println(strLine);
825+ CmnUtils.errorPrint(strSplit[LINE][COL06] + ",UNUSABLE INDEX");
762826 }
763827 }
764- while((strLine=br[2].readLine()) != null){
765- strSplit[0] = CmnUtils.splitSpace(strLine);
766- rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[0][5].replaceAll("\"",""));
828+ while((strLine=br[R_CREATE_UKEY].readLine()) != null){
829+ strSplit[LINE] = CmnUtils.splitSpace(strLine);
830+ rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[LINE][COL06].replaceAll("\"",""));
767831 if (rowNo != -1){
768832 rowData = rowData = CmnUtils.getArrayRowData(alData, 12, rowNo);
769- CmnUtils.debugPrint(strSplit[0][5] + ":" + rowNo);
833+ CmnUtils.debugPrint(strSplit[LINE][COL06] + ":" + rowNo);
770834 for(int i=0;i<rowData.length;i++)CmnUtils.debugPrint(rowData[i]);
771- tbName = rowData[0];
772- objName = rowData[1];
773- objTyp = rowData[2];
774- pctFree = rowData[3];
775- pctUsed = rowData[4];
776- iniTrns = rowData[5];
777- freeLst = rowData[6];
778- flstGrp = rowData[7];
779- bufPool = rowData[8];
780- tblSpace = rowData[9];
781- logging = rowData[10];
782- segByts = rowData[11];
783- pw[2].print(strLine.replace(';',' '));
784- pw[2].print("USING INDEX PCTFREE " + pctFree);
785- pw[2].print(" INITRANS " + iniTrns + " STORAGE(");
786- if(!freeLst.equals(""))pw[2].print(" FREELISTS " + freeLst);
787- if(!flstGrp.equals(""))pw[2].print(" FREELIST GROUPS " + flstGrp);
788- pw[2].print(" BUFFER_POOL " + bufPool + ")");
789- pw[2].print(" TABLESPACE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tblSpace + cp.DB_SQL_QUOTEDE[cp.dbType]);
835+ tbName = rowData[COL01];
836+ objName = rowData[COL02];
837+ objTyp = rowData[COL03];
838+ pctFree = rowData[COL04];
839+ pctUsed = rowData[COL05];
840+ iniTrns = rowData[COL06];
841+ freeLst = rowData[COL07];
842+ flstGrp = rowData[COL08];
843+ bufPool = rowData[COL09];
844+ tblSpace = rowData[COL10];
845+ logging = rowData[COL11];
846+ segByts = rowData[COL12];
847+ pw[W_CREATE_UKEY].print(strLine.replace(';',' '));
848+ pw[W_CREATE_UKEY].print("USING INDEX PCTFREE " + pctFree);
849+ pw[W_CREATE_UKEY].print(" INITRANS " + iniTrns + " STORAGE(");
850+ if(!freeLst.equals(""))pw[W_CREATE_UKEY].print(" FREELISTS " + freeLst);
851+ if(!flstGrp.equals(""))pw[W_CREATE_UKEY].print(" FREELIST GROUPS " + flstGrp);
852+ pw[W_CREATE_UKEY].print(" BUFFER_POOL " + bufPool + ")");
853+ pw[W_CREATE_UKEY].print(" TABLESPACE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tblSpace + cp.DB_SQL_QUOTEDE[cp.dbType]);
790854 if(logging.equals("NO")){
791- pw[2].println(" NOLOGGING" + cp.SQL_TERMINATOR[cp.dbType]);
855+ pw[W_CREATE_UKEY].println(" NOLOGGING" + cp.SQL_TERMINATOR[cp.dbType]);
792856 } else {
793- pw[2].println(cp.SQL_TERMINATOR[cp.dbType]);
857+ pw[W_CREATE_UKEY].println(cp.SQL_TERMINATOR[cp.dbType]);
794858 }
795859 } else {
796- pw[2].println(strLine);
797- CmnUtils.errorPrint(strSplit[0][5] + ",UNUSABLE INDEX");
860+ pw[W_CREATE_UKEY].println(strLine);
861+ CmnUtils.errorPrint(strSplit[LINE][COL06] + ",UNUSABLE INDEX");
798862 }
799863 }
800- while((strLine=br[3].readLine()) != null){
801- strSplit[0] = CmnUtils.splitSpace(strLine);
802- rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[0][2].replaceAll("\"",""));
864+ while((strLine=br[R_CREATE_INDEX].readLine()) != null){
865+ strSplit[LINE] = CmnUtils.splitSpace(strLine);
866+ rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[LINE][COL03].replaceAll("\"",""));
803867 CmnUtils.debugPrint("rowNo=" + rowNo);
804868 if (rowNo != -1){
805869 rowData = CmnUtils.getArrayRowData(alData, 12, rowNo);
806870 for(int i=0;i<rowData.length;i++)CmnUtils.debugPrint(rowData[i]);
807- tbName = rowData[0];
808- objName = rowData[1];
809- objTyp = rowData[2];
810- pctFree = rowData[3];
811- pctUsed = rowData[4];
812- iniTrns = rowData[5];
813- freeLst = rowData[6];
814- flstGrp = rowData[7];
815- bufPool = rowData[8];
816- tblSpace = rowData[9];
817- logging = rowData[10];
818- segByts = rowData[11];
819- pw[3].print(strLine.replace(';',' '));
820- pw[3].print("PCTFREE " + pctFree);
821- pw[3].print(" INITRANS " + iniTrns + " STORAGE(");
822- if(!freeLst.equals(""))pw[3].print(" FREELISTS " + freeLst);
823- if(!flstGrp.equals(""))pw[3].print(" FREELIST GROUPS " + flstGrp);
824- pw[3].print(" BUFFER_POOL " + bufPool + ")");
825- pw[3].print(" TABLESPACE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tblSpace + cp.DB_SQL_QUOTEDE[cp.dbType]);
871+ tbName = rowData[COL01];
872+ objName = rowData[COL02];
873+ objTyp = rowData[COL03];
874+ pctFree = rowData[COL04];
875+ pctUsed = rowData[COL05];
876+ iniTrns = rowData[COL06];
877+ freeLst = rowData[COL07];
878+ flstGrp = rowData[COL08];
879+ bufPool = rowData[COL09];
880+ tblSpace = rowData[COL10];
881+ logging = rowData[COL11];
882+ segByts = rowData[COL12];
883+ pw[W_CREATE_INDEX].print(strLine.replace(';',' '));
884+ pw[W_CREATE_INDEX].print("PCTFREE " + pctFree);
885+ pw[W_CREATE_INDEX].print(" INITRANS " + iniTrns + " STORAGE(");
886+ if(!freeLst.equals(""))pw[W_CREATE_INDEX].print(" FREELISTS " + freeLst);
887+ if(!flstGrp.equals(""))pw[W_CREATE_INDEX].print(" FREELIST GROUPS " + flstGrp);
888+ pw[W_CREATE_INDEX].print(" BUFFER_POOL " + bufPool + ")");
889+ pw[W_CREATE_INDEX].print(" TABLESPACE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tblSpace + cp.DB_SQL_QUOTEDE[cp.dbType]);
826890 if(logging.equals("NO")){
827- pw[3].println(" NOLOGGING" + cp.SQL_TERMINATOR[cp.dbType]);
891+ pw[W_CREATE_INDEX].println(" NOLOGGING" + cp.SQL_TERMINATOR[cp.dbType]);
828892 } else {
829- pw[3].println(cp.SQL_TERMINATOR[cp.dbType]);
893+ pw[W_CREATE_INDEX].println(cp.SQL_TERMINATOR[cp.dbType]);
830894 }
831895 } else {
832- pw[3].println(strLine);
833- CmnUtils.errorPrint(strSplit[0][2] + ",UNUSABLE INDEX");
896+ pw[W_CREATE_INDEX].println(strLine);
897+ CmnUtils.errorPrint(strSplit[LINE][COL03] + ",UNUSABLE INDEX");
898+ }
899+ }
900+ for(int i=0;i<pw.length;i++){
901+ if(pw[i]!=null){
902+ pw[i].close();
903+ pw[i]=null;
904+ }
905+ }
906+ for(int i=0;i<br.length;i++){
907+ if(br[i]!=null){
908+ br[i].close();
909+ br[i]=null;
834910 }
835911 }
836- for(int i=1;i<4;i++)pw[i].close();
837- for(int i=1;i<4;i++)pw[i]=null;
838- for(int i=0;i<4;i++)br[i].close();
839- for(int i=0;i<4;i++)br[i]=null;
840912
841- File [] fmFl = new File[6];
842- File [] toFl = new File[6];
913+ File [] fmFl = new File[3];
914+ File [] toFl = new File[3];
843915
844- fmFl[0] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY] + "." + phyfileExtension);
845- fmFl[1] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY] + "." + phyfileExtension);
846- fmFl[2] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX] + "." + phyfileExtension);
847- toFl[0] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY]);
848- toFl[1] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY]);
849- toFl[2] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX]);
850- for(int i=0;i<3;i++){
916+ fmFl[W_CREATE_PKEY] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY] + "." + phyfileExtension);
917+ fmFl[W_CREATE_UKEY] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY] + "." + phyfileExtension);
918+ fmFl[W_CREATE_INDEX] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX] + "." + phyfileExtension);
919+ toFl[W_CREATE_PKEY] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY]);
920+ toFl[W_CREATE_UKEY] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY]);
921+ toFl[W_CREATE_INDEX] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX]);
922+ for(int i=0;i<toFl.length;i++){
851923 CmnUtils.debugPrint(fmFl[i].toString() + ">" + toFl[i].toString());
852924 toFl[i].delete();
853925 fmFl[i].renameTo(toFl[i]);
@@ -863,50 +935,50 @@ public class RapideMetaUnloader{
863935 tbName = tb.getName().replaceAll(".sql","");
864936 oTb = new File(tb + "." + phyfileExtension);
865937 CmnUtils.debugPrint(tbName);
866- br[0] = new BufferedReader(new FileReader(tb));
867- pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(oTb)));
868- while((strLine=br[0].readLine()) != null){
938+ br[WK_FILE] = new BufferedReader(new FileReader(tb));
939+ pw[CONTENTS] = new PrintWriter(new BufferedWriter(new FileWriter(oTb)));
940+ while((strLine=br[WK_FILE].readLine()) != null){
869941 if(strLine.equals(")" + cp.SQL_TERMINATOR[cp.dbType])){
870942 rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, tbName);
871943 if (rowNo != -1){
872944 rowData = CmnUtils.getArrayRowData(alData, 12, rowNo);
873945 CmnUtils.debugPrint(tbName + ":" + rowNo);
874946 //for(int j=0;j<rowData.length;i++)CmnUtils.debugPrint(rowData[j]);
875- tbName = rowData[0];
876- objName = rowData[1];
877- objTyp = rowData[2];
878- pctFree = rowData[3];
879- pctUsed = rowData[4];
880- iniTrns = rowData[5];
881- freeLst = rowData[6];
882- flstGrp = rowData[7];
883- bufPool = rowData[8];
884- tblSpace = rowData[9];
885- logging = rowData[10];
886- segByts = rowData[11];
887- pw[0].print(") PCTFREE " + pctFree);
888- if(!pctUsed.equals(""))pw[0].print(" PCTUSED " + pctUsed);
889- pw[0].print(" INITRANS " + iniTrns + " STORAGE(");
890- if(!freeLst.equals(""))pw[0].print(" FREELISTS " + freeLst);
891- if(!flstGrp.equals(""))pw[0].print(" FREELIST GROUPS " + flstGrp);
892- pw[0].print(" BUFFER_POOL " + bufPool + ")");
893- pw[0].print(" TABLESPACE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tblSpace + cp.DB_SQL_QUOTEDE[cp.dbType]);
947+ tbName = rowData[COL01];
948+ objName = rowData[COL02];
949+ objTyp = rowData[COL03];
950+ pctFree = rowData[COL04];
951+ pctUsed = rowData[COL05];
952+ iniTrns = rowData[COL06];
953+ freeLst = rowData[COL07];
954+ flstGrp = rowData[COL08];
955+ bufPool = rowData[COL09];
956+ tblSpace = rowData[COL10];
957+ logging = rowData[COL11];
958+ segByts = rowData[COL12];
959+ pw[CONTENTS].print(") PCTFREE " + pctFree);
960+ if(!pctUsed.equals(""))pw[CONTENTS].print(" PCTUSED " + pctUsed);
961+ pw[CONTENTS].print(" INITRANS " + iniTrns + " STORAGE(");
962+ if(!freeLst.equals(""))pw[CONTENTS].print(" FREELISTS " + freeLst);
963+ if(!flstGrp.equals(""))pw[CONTENTS].print(" FREELIST GROUPS " + flstGrp);
964+ pw[CONTENTS].print(" BUFFER_POOL " + bufPool + ")");
965+ pw[CONTENTS].print(" TABLESPACE " + cp.DB_SQL_QUOTEDS[cp.dbType]+ tblSpace + cp.DB_SQL_QUOTEDE[cp.dbType]);
894966 if(logging.equals("NO")){
895- pw[0].println(" NOLOGGING" + cp.SQL_TERMINATOR[cp.dbType]);
967+ pw[CONTENTS].println(" NOLOGGING" + cp.SQL_TERMINATOR[cp.dbType]);
896968 } else {
897- pw[0].println(cp.SQL_TERMINATOR[cp.dbType]);
969+ pw[CONTENTS].println(cp.SQL_TERMINATOR[cp.dbType]);
898970 }
899971 } else {
900- pw[0].println(")" + cp.SQL_TERMINATOR[cp.dbType]);
972+ pw[CONTENTS].println(")" + cp.SQL_TERMINATOR[cp.dbType]);
901973 }
902974 } else {
903- pw[0].println(strLine);
975+ pw[CONTENTS].println(strLine);
904976 }
905977 }
906- pw[0].close();
907- pw[0]=null;
908- br[0].close();
909- br[0]=null;
978+ pw[CONTENTS].close();
979+ pw[CONTENTS]=null;
980+ br[WK_FILE].close();
981+ br[WK_FILE]=null;
910982 tb.delete();
911983 oTb.renameTo(tb);
912984 }
@@ -916,7 +988,7 @@ public class RapideMetaUnloader{
916988 // Remove work file
917989 File fl= null;
918990 for(int i=0;i<cp.meta_sql[cp.dbType].length;i++){
919- fl= new File(folder + "/" + cp.FILE_NAME[i] + "_" + database + "." + cp.fileExtension);
991+ fl= new File(folder + "/" + cp.WK_FILE_NAME[i] + "_" + database + "." + cp.fileExtension);
920992 CmnUtils.debugPrint(fl.toString());
921993 fl.delete();
922994 }
Show on old repository browser