--- FM2SQL/Attic/Convert.java 2004/03/15 12:30:51 1.47 +++ FM2SQL/Attic/Convert.java 2004/03/23 11:57:06 1.51 @@ -1,3 +1,17 @@ +/* + * Convert.java -- Converter class - Filemaker to SQL Converter + * Copyright (C) 2004 Robert Gordesch (rogo@mpiwg-berlin.mpg.de) + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. Please read license.txt for the full details. A copy of + * the GPL may be found at http://www.gnu.org/copyleft/lgpl.html You should + * have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA Created on 15.09.2003 by + * rogo + */ + import java.util.*; import java.sql.*; import java.awt.Cursor; @@ -1150,6 +1164,9 @@ class Convert mode = DataBase.APPEND_MODE; else if (modeString.equals("update")) mode = DataBase.UPDATE_MODE; + else if (modeString.equals("delete")) + mode = DataBase.DELETE_MODE; + // if(node3!=null) // System.out.println(node3.name); @@ -1321,6 +1338,9 @@ class Convert mode = DataBase.APPEND_MODE; else if (modeString.equals("update")) mode = DataBase.UPDATE_MODE; + else if (modeString.equals("delete")) + mode = DataBase.DELETE_MODE; + // if(node3!=null) // System.out.println(node3.name); @@ -1517,6 +1537,8 @@ class Convert modeString = "append"; else if (mode == UPDATE_MODE) modeString = "update"; + else if (mode == DELETE_MODE) + modeString = "delete"; buffr.write(" " + modeString + "\n"); int index = 0; @@ -1663,7 +1685,6 @@ class Convert Vector vecDest = null; // tempo beanDest.setConnection(destination); - int rowCount = (idField != "") ? myIds.size() : bean.getRowCount(query); String tempID = bean.getQC() + idField + bean.getQC(); String tempIDdest = beanDest.getQC() + convertText(idField) + beanDest.getQC(); @@ -1671,7 +1692,8 @@ class Convert int endIndex = -1; String tempQuery = query; String destQuery = query.replaceAll(names.get(tbIndex).toString(), destTableName); - String tempQueryDest = destQuery.substring(0,destQuery.lastIndexOf(destTableName)+destTableName.length()+1); + String tempQueryDest = destQuery; + // remove extra query parts destQuery.substring(0,destQuery.lastIndexOf(destTableName)+destTableName.length()+1); System.out.println("new Query " + tempQueryDest); if (!idField.equals("")) { @@ -1733,7 +1755,7 @@ class Convert while (true) { - j++; + ++j; if (j == linesToDelete.size()) break; //print rows