version 1.61, 2004/07/12 10:15:13
|
version 1.62, 2004/07/22 10:43:29
|
Line 25 import java.io.OutputStreamWriter;
|
Line 25 import java.io.OutputStreamWriter;
|
import java.io.PrintStream; |
import java.io.PrintStream; |
import java.io.UnsupportedEncodingException; |
import java.io.UnsupportedEncodingException; |
import java.net.URL; |
import java.net.URL; |
import java.net.URLConnection; |
|
import java.sql.PreparedStatement; |
import java.sql.PreparedStatement; |
import java.sql.SQLException; |
import java.sql.SQLException; |
import java.sql.Statement; |
import java.sql.Statement; |
Line 1262 class Convert
|
Line 1261 class Convert
|
mode = DataBase.UPDATE_MODE; |
mode = DataBase.UPDATE_MODE; |
else if (modeString.equals("delete")) |
else if (modeString.equals("delete")) |
mode = DataBase.DELETE_MODE; |
mode = DataBase.DELETE_MODE; |
|
else if (modeString.equals("synchronize")) |
|
mode = DataBase.SYNCHRONIZE_MODE; |
|
|
// if(node3!=null) |
// if(node3!=null) |
// System.out.println(node3.name); |
// System.out.println(node3.name); |
Line 1330 class Convert
|
Line 1331 class Convert
|
for (Iterator iter = databases.iterator(); iter.hasNext();) |
for (Iterator iter = databases.iterator(); iter.hasNext();) |
{ |
{ |
DataBase db = (DataBase) iter.next(); |
DataBase db = (DataBase) iter.next(); |
if (mode != DataBase.UPDATE_MODE) |
if (mode == DataBase.CONVERT_MODE || mode == DataBase.APPEND_MODE) |
convertBatch(db.bean, database, db.tables, db.layouts, db.selects, db.creates, db.ids, mode, db.delimiter); |
convertBatch(db.bean, database, db.tables, db.layouts, db.selects, db.creates, db.ids, mode, db.delimiter); |
else |
else |
|
if (mode == DataBase.UPDATE_MODE) |
update(db.bean.url, database.url, db.tables, db.layouts, db.selects, db.creates, db.ids, mode); |
update(db.bean.url, database.url, db.tables, db.layouts, db.selects, db.creates, db.ids, mode); |
|
else if(mode==DataBase.SYNCHRONIZE_MODE) |
|
{ |
|
user =bean.user; |
|
passwd =bean.passwd; |
|
userDest =database.user; |
|
passwdDest =database.passwd; |
|
|
|
synchronize(db.bean.url, database.url, db.tables, db.layouts, db.selects, db.creates, db.ids, mode); |
|
} |
} |
} |
// printContents(node3); |
// printContents(node3); |
// FM2SQL.fmInstance=new FM2SQL(); |
// FM2SQL.fmInstance=new FM2SQL(); |
Line 1616 class Convert
|
Line 1626 class Convert
|
final static int APPEND_MODE = 2; |
final static int APPEND_MODE = 2; |
final static int UPDATE_MODE = 3; |
final static int UPDATE_MODE = 3; |
final static int DELETE_MODE = 4; |
final static int DELETE_MODE = 4; |
|
final static int SYNCHRONIZE_MODE = 5; |
|
|
int mode = -1; |
int mode = -1; |
|
|
Line 1934 class Convert
|
Line 1945 class Convert
|
// TODO using id based algorithm |
// TODO using id based algorithm |
public static void synchronize(String source, String destination, Vector names, Vector layouts, Vector selects, Vector creates, Vector ids, int mode) throws Exception |
public static void synchronize(String source, String destination, Vector names, Vector layouts, Vector selects, Vector creates, Vector ids, int mode) throws Exception |
{ |
{ |
|
System.out.println(" bin in synchronize!!!"); |
FM2SQL.ProgressDialog dialog = null; |
FM2SQL.ProgressDialog dialog = null; |
if (FM2SQL.fmInstance != null) |
if (FM2SQL.fmInstance != null) |
{ |
{ |
Line 1979 class Convert
|
Line 1991 class Convert
|
String layout = (layouts.isEmpty()) ? "" : layouts.get(tbIndex).toString(); |
String layout = (layouts.isEmpty()) ? "" : layouts.get(tbIndex).toString(); |
query = (selects != null) ? selects.get(tbIndex).toString() : query; |
query = (selects != null) ? selects.get(tbIndex).toString() : query; |
//if vectors[1].get(i) != null) |
//if vectors[1].get(i) != null) |
if (layout != "") |
if (!layout.equals("")) |
{ |
{ |
layout = " layout " + bean.getQC() + layout + bean.getQC(); |
layout = " layout " + bean.getQC() + layout + bean.getQC(); |
String name = names.get(tbIndex).toString(); |
String name = names.get(tbIndex).toString(); |
Line 1989 class Convert
|
Line 2001 class Convert
|
System.out.println("added layout " + query); |
System.out.println("added layout " + query); |
|
|
} |
} |
|
if(dialog!=null) { |
dialog.title.setText("Getting table data ..."); |
dialog.title.setText("Getting table data ..."); |
dialog.table.setText(names.get(tbIndex).toString()); |
dialog.table.setText(names.get(tbIndex).toString()); |
dialog.status.setText("Table " + (tbIndex + 1) + " of " + names.size()); |
dialog.status.setText("Table " + (tbIndex + 1) + " of " + names.size()); |
dialog.show(); |
dialog.show(); |
|
} |
bean.getConnection(); |
bean.getConnection(); |
bean.makeQuery(query, 50); |
bean.makeQuery(query, 50); |
idField = ids.get(tbIndex).toString(); |
idField = ids.get(tbIndex).toString(); |
Line 2055 class Convert
|
Line 2069 class Convert
|
linesToAppend.removeAll(vecDest); |
linesToAppend.removeAll(vecDest); |
// remove all lines that should not be deleted |
// remove all lines that should not be deleted |
linesToDelete.removeAll(deleted); |
linesToDelete.removeAll(deleted); |
|
System.out.println("linesToAppend "+linesToAppend+" "+vecDest+" "+destTableName); |
|
System.exit(0); |
// System.out.println("ID LIST SIZE " + Math.round((double) myIds.size() / (double) numIntervalls) + " " + myIdsDest.size()); |
// System.out.println("ID LIST SIZE " + Math.round((double) myIds.size() / (double) numIntervalls) + " " + myIdsDest.size()); |
/// @TODO complete delete task remove query show lines to be deleted let user choose if he wants that |
/// @TODO complete delete task remove query show lines to be deleted let user choose if he wants that |
System.out.println("number of lines to be deleted " + linesToDelete.size()); |
System.out.println("number of lines to be deleted " + linesToDelete.size()); |