Diff for /FM2SQL/Attic/Convert.java between versions 1.20 and 1.26

version 1.20, 2004/01/26 11:29:41 version 1.26, 2004/02/09 09:44:49
Line 25  class Convert Line 25  class Convert
   static String userDest="postgres",passwdDest="rogo";    static String userDest="postgres",passwdDest="rogo";
   static boolean batchRun=false;    static boolean batchRun=false;
   static Vector databases = new Vector();    static Vector databases = new Vector();
       final static int numIntervalls = 10;
   public static void main(String args[])    public static void main(String args[])
   {    {
 /*    try  /*    try
Line 381  class Convert Line 381  class Convert
           dialog.title.setText("Writing table data ...");            dialog.title.setText("Writing table data ...");
   
         int j = -1;          int j = -1;
                 System.out.println(bean.getIDVector(ids.get(tbIndex).toString(),(String) names.get(tbIndex)).size());  
           
         Vector row = null;          Vector row = null;
         command = new StringBuffer();          command = new StringBuffer();
Line 482  class Convert Line 481  class Convert
   
   
   
   public static void  convert(String source,String destination,Vector names,Vector layouts,Vector selects,Vector creates,int mode) throws Exception    public static void  convert(String source,String destination,Vector names,Vector layouts,Vector selects,Vector creates,Vector ids,int mode) throws Exception
   {    {
    FM2SQL.ProgressDialog dialog = new  FM2SQL.ProgressDialog(FM2SQL.fmInstance);     FM2SQL.ProgressDialog dialog = new  FM2SQL.ProgressDialog(FM2SQL.fmInstance);
    dialog.setTitle("Conversion running ...");     dialog.setTitle("Conversion running ...");
Line 490  class Convert Line 489  class Convert
    dialog.setLocation(FM2SQL.fmInstance.getLocationOnScreen().x+(FM2SQL.fmInstance.getWidth()-400)/2,FM2SQL.fmInstance.getLocationOnScreen().y+(FM2SQL.fmInstance.getHeight()-250)/2);      dialog.setLocation(FM2SQL.fmInstance.getLocationOnScreen().x+(FM2SQL.fmInstance.getWidth()-400)/2,FM2SQL.fmInstance.getLocationOnScreen().y+(FM2SQL.fmInstance.getHeight()-250)/2); 
      dialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));       dialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
      FM2SQL.fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));       FM2SQL.fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        java.util.TreeSet myIds;
      int deltaID = 1;
    dialog.thread=Thread.currentThread();     dialog.thread=Thread.currentThread();
    // setting user and passwd      // setting user and passwd 
    bean.setUserAndPasswd(user,passwd);     bean.setUserAndPasswd(user,passwd);
Line 512  class Convert Line 513  class Convert
       for(tbIndex=0;tbIndex<names.size();++tbIndex)        for(tbIndex=0;tbIndex<names.size();++tbIndex)
       {        {
         Vector[] result = null;          Vector[] result = null;
        try {        try
         {
         query = "select * from " + bean.getQC() +names.get(tbIndex).toString() + bean.getQC();          query = "select * from " + bean.getQC() +names.get(tbIndex).toString() + bean.getQC();
        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;
Line 535  class Convert Line 537  class Convert
         dialog.show();          dialog.show();
         //result = bean.getQueryData(query, dialog, 0);          //result = bean.getQueryData(query, dialog, 0);
         bean.getConnection();          bean.getConnection();
         bean.makeQuery(query,0);          bean.makeQuery(query, 50);
          // @TODO id Vector must be used in querys while loop over id ranges where id>=start and id<=end
           myIds = bean.getIDVector(ids.get(tbIndex).toString(),(String) names.get(tbIndex),query);
           System.out.println("ID LIST SIZE "+Math.round((double)myIds.size()/(double)numIntervalls)+" "+myIds.size());
           deltaID =(int) Math.round((double)myIds.size()/(double)numIntervalls);
       } catch (Exception e)        } catch (Exception e)
         {          {
           continue;            continue;
Line 639  class Convert Line 645  class Convert
     command.append("?)");      command.append("?)");
     PreparedStatement pstm = beanDest.getConnection().prepareStatement(command.toString());      PreparedStatement pstm = beanDest.getConnection().prepareStatement(command.toString());
     System.out.println(command);      System.out.println(command);
     int rowCount= bean.getRowCount(query);      int rowCount= myIds.size();//bean.getRowCount(query)
       Vector vec = new Vector(myIds);
       int endIndex = -1;
       for(int k=0;k<vec.size()-deltaID;k=k+deltaID)
       {
         System.out.println(vec.get(k)+" "+vec.get(k+deltaID)+" "+vec.lastElement());
         endIndex = k+deltaID;
       }
       if((vec.size()-1)%numIntervalls==0) System.out.println("fits");
       else
        {
          System.out.println(" last intervall from "+vec.get(endIndex)+" "+vec.lastElement());
        } 
     while((row=bean.getNextRow())!=null)      while((row=bean.getNextRow())!=null)
     {      {
       j++;        j++;

Removed from v.1.20  
changed lines
  Added in v.1.26


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>