--- FM2SQL/Attic/Convert.java 2004/03/01 12:37:10 1.41
+++ FM2SQL/Attic/Convert.java 2004/03/02 12:04:27 1.42
@@ -59,11 +59,11 @@ class Convert
System.out.println("Finished!");
//convert("jdbc:fmpro:http://141.14.237.74:8050","jdbc:postgresql://erebos/test",null,null);
}
- public static void convertBatch(DBBean source, DBBean destination, Vector names, Vector layouts, Vector selects, Vector creates, Vector ids,int mode) throws Exception
+ public static void convertBatch(DBBean source, DBBean destination, Vector names, Vector layouts, Vector selects, Vector creates, Vector ids,int mode,String delimiter) throws Exception
{
bean = source;
beanDest = destination;
- convert(null,null,names,layouts,selects,creates,ids,mode);
+ convert(null,null,names,layouts,selects,creates,ids,mode,delimiter);
if(true) return;
StringBuffer command = null;
try
@@ -435,7 +435,7 @@ class Convert
*/
- public static void convert(String source, String destination, Vector names, Vector layouts, Vector selects, Vector creates, Vector ids, int mode) throws Exception
+ public static void convert(String source, String destination, Vector names, Vector layouts, Vector selects, Vector creates, Vector ids, int mode,String delimiter) throws Exception
{
FM2SQL.ProgressDialog dialog = null;
@@ -1079,6 +1079,7 @@ class Convert
Vector selects = new Vector();
Vector creates = new Vector();
Vector ids = new Vector();
+ String delimiter = "|";
int mode = -1;
try
@@ -1103,7 +1104,7 @@ class Convert
Node node2 = root.find("convert/source/database/password", new int[] { 1, 1, i, 1, 1 });
Node node3 = root.find("convert/source/database", new int[] { 1, 1, i });
Node nodeMode = root.find("convert/source/database/mode", new int[] { 1, 1, i, 1, 1 });
-
+ Node delimiterNode =root.find("convert/source/database/delimiter", new int[] { 1, 1, i, 1, 1 });
if (node3 == null)
throw new Error("parse error database tag missing");
if (node == null)
@@ -1112,6 +1113,7 @@ class Convert
throw new Error("parse error user tag missing");
if (node2 == null)
throw new Error("parse error password tag missing");
+ if(delimiterNode!=null) delimiter = delimiterNode.getCharacters();
String url = node.getCharacters();
String user = node1.getCharacters();
String password = node2.getCharacters();
@@ -1179,7 +1181,9 @@ class Convert
creates.add("");
}
- databases.add(new DataBase(database, tables, layouts, selects, creates, ids, mode));
+ DataBase dataBase = new DataBase(database, tables, layouts, selects, creates, ids, mode);
+ dataBase.delimiter = delimiter;
+ databases.add(dataBase);
}
DBBean database = new DBBean();
// parse dataBase
@@ -1197,7 +1201,7 @@ class Convert
{
DataBase db = (DataBase) iter.next();
if (mode != DataBase.UPDATE_MODE)
- convertBatch(db.bean, database, db.tables, db.layouts, db.selects, db.creates, db.ids,mode);
+ convertBatch(db.bean, database, db.tables, db.layouts, db.selects, db.creates, db.ids,mode,db.delimiter);
else
update(db.bean.url, database.url, db.tables, db.layouts, db.selects, db.creates, db.ids, mode);
@@ -1245,7 +1249,7 @@ class Convert
Vector selects = new Vector();
Vector creates = new Vector();
Vector ids = new Vector();
-
+ String delimiter = "|";
int mode = -1;
try
{
@@ -1269,6 +1273,9 @@ class Convert
Node node2 = root.find("convert/source/database/password", new int[] { 1, 1, i, 1, 1 });
Node node3 = root.find("convert/source/database", new int[] { 1, 1, i });
Node nodeMode = root.find("convert/source/database/mode", new int[] { 1, 1, i, 1, 1 });
+ Node delimiterNode =root.find("convert/source/database/delimiter", new int[] { 1, 1, i, 1, 1 });
+
+ if(delimiterNode!=null) delimiter = delimiterNode.getCharacters();
if (node3 == null)
throw new Error("parse error database tag missing");
@@ -1454,6 +1461,7 @@ class Convert
Vector layouts;
Vector tables;
Vector ids;
+ String delimiter = "|";
final static int CONVERT_MODE = 1;
final static int APPEND_MODE = 2;
final static int UPDATE_MODE = 3;
@@ -1473,7 +1481,7 @@ class Convert
this.bean.setIDVector(ids);
}
/**
- * writes the data contained in this object th the buffered writer
+ * writes the data contained in this object to the buffered writer
* * @param buffr
* @throws Exception
*/
@@ -1484,6 +1492,7 @@ class Convert
buffr.write(" " + bean.url + "\n");
buffr.write(" " + bean.user + "\n");
buffr.write(" " + bean.passwd + "\n");
+ buffr.write(" "+delimiter+"\n");
String modeString = "";
if (mode == CONVERT_MODE)
modeString = "convert";