--- FM2SQL/Attic/Convert.java 2004/01/16 10:21:01 1.12 +++ FM2SQL/Attic/Convert.java 2004/01/19 09:40:50 1.16 @@ -304,7 +304,7 @@ class Convert } - public static void update(String source, String destination, Vector names, Vector layouts, Vector selects, Vector creates, int mode) throws Exception + public static void update(String source, String destination, Vector names, Vector layouts, Vector selects, Vector creates, Vector ids,int mode) throws Exception { FM2SQL.ProgressDialog dialog = null; if (FM2SQL.fmInstance != null) @@ -393,11 +393,13 @@ class Convert int size = bean.getColumnNames().size(); for (int i = 0; i < size - 1; ++i) - command.append(convertText((String)bean.getColumnNames().get(i))+" = ?"); - command.append(convertText((String)bean.getColumnNames().get(size-1))+" = ?"); + command.append(beanDest.getQC()+convertText((String)bean.getColumnNames().get(i))+beanDest.getQC()+" = ? ,"); + command.append(convertText((String)bean.getColumnNames().get(size-1))+" = ? "); + command.append("WHERE "+convertText(ids.get(tbIndex).toString())+ " = ?"); PreparedStatement pstm = beanDest.getConnection().prepareStatement(command.toString()); - System.out.println(command); + System.out.println(command+" "+tbIndex); int rowCount = bean.getRowCount(query); + int idIndex = bean.getColumnNames().indexOf(ids.get(tbIndex) ); while ((row = bean.getNextRow()) != null) { j++; @@ -439,6 +441,9 @@ class Convert else pstm.setNull(k + 1, Types.NULL); } + pstm.setString(row.size()+1,row.get(idIndex).toString()); + //System.out.println(pstm.toString()); + // System.exit(0); pstm.execute(); //stm.executeUpdate(command.toString()); if(dialog!=null) @@ -781,7 +786,15 @@ class Convert { alterMe.setCharAt(j, '_'); - } + } else if (alterMe.charAt(j) == '?') + { + // changed ? to _ because of update statement + alterMe.setCharAt(j,'_'); + // length = length + 1; + // j=j+1; + System.out.println(alterMe); + } + else if (alterMe.charAt(j) == '.') { if(j==length-1) @@ -1389,9 +1402,11 @@ public static class DataBase this.creates = creates; this.ids = ids; this.mode = mode; + this.bean.setIDVector(ids); } public void exportToXML(BufferedWriter buffr) throws Exception { + // ids=bean.getIDVector(); buffr.write(" \n"); buffr.write(" "+bean.url+"\n"); buffr.write(" "+bean.user+"\n"); @@ -1416,7 +1431,7 @@ public static class DataBase String create=(String)creates.get(index); String id=(String)ids.get(index); - buffr.write(" \n"); + buffr.write("
\n"); buffr.write(" \n"); if(!create.equals("")) buffr.write(" "+create+" \n");