--- FM2SQL/Attic/Convert.java 2004/03/15 12:52:00 1.48 +++ FM2SQL/Attic/Convert.java 2004/04/06 10:34:15 1.54 @@ -1,3 +1,17 @@ +/* + * Convert.java -- Converter class - Filemaker to SQL Converter + * Copyright (C) 2003 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; @@ -249,7 +263,7 @@ class Convert FM2SQL.ProgressDialog dialog = null; if (FM2SQL.fmInstance != null) { - dialog = new FM2SQL.ProgressDialog(FM2SQL.fmInstance); + dialog = new FM2SQL.ProgressDialog(FM2SQL.fmInstance,bean); dialog.setTitle("Conversion running ..."); dialog.title.setText("Getting table data ..."); dialog.setLocation(FM2SQL.fmInstance.getLocationOnScreen().x + (FM2SQL.fmInstance.getWidth() - 400) / 2, FM2SQL.fmInstance.getLocationOnScreen().y + (FM2SQL.fmInstance.getHeight() - 250) / 2); @@ -456,7 +470,7 @@ class Convert if (FM2SQL.fmInstance != null) { - dialog = new FM2SQL.ProgressDialog(FM2SQL.fmInstance); + dialog = new FM2SQL.ProgressDialog(FM2SQL.fmInstance,bean); dialog.setTitle("Conversion running ..."); dialog.title.setText("Getting table data ..."); dialog.setLocation(FM2SQL.fmInstance.getLocationOnScreen().x + (FM2SQL.fmInstance.getWidth() - 400) / 2, FM2SQL.fmInstance.getLocationOnScreen().y + (FM2SQL.fmInstance.getHeight() - 250) / 2); @@ -810,12 +824,16 @@ class Convert for (int k = 0; k < row.size(); ++k) { obj = row.get(k); - if (obj instanceof ArrayList) - if (obj instanceof ArrayList) + + if (obj instanceof ArrayList) obj = formatFileMakerArray((List) obj,delimiter); String str = (obj == null) ? "NULL" : obj.toString(); - if (!str.equals("NULL")) + if(obj instanceof Double) + { + pstm.setDouble(k + 1, ((Double)obj).doubleValue()); + }else + if (!str.equals("NULL")) pstm.setString(k + 1, str); else pstm.setNull(k + 1, Types.NULL); @@ -1590,7 +1608,7 @@ class Convert FM2SQL.ProgressDialog dialog = null; if (FM2SQL.fmInstance != null) { - dialog = new FM2SQL.ProgressDialog(FM2SQL.fmInstance); + dialog = new FM2SQL.ProgressDialog(FM2SQL.fmInstance,bean); dialog.setTitle("Conversion running ..."); dialog.title.setText("Getting table data ..."); dialog.setLocation(FM2SQL.fmInstance.getLocationOnScreen().x + (FM2SQL.fmInstance.getWidth() - 400) / 2, FM2SQL.fmInstance.getLocationOnScreen().y + (FM2SQL.fmInstance.getHeight() - 250) / 2); @@ -1671,7 +1689,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(); @@ -1679,7 +1696,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("")) {