version 1.2, 2003/12/10 12:25:12
|
version 1.3, 2004/01/08 10:31:18
|
Line 213 class Convert
|
Line 213 class Convert
|
//dialog.title.setText("Writing table data ..."); |
//dialog.title.setText("Writing table data ..."); |
Vector row = null; |
Vector row = null; |
//for (int j = 0; j < result[0].size(); ++j) |
//for (int j = 0; j < result[0].size(); ++j) |
|
command = new StringBuffer(); |
|
|
|
command.append("INSERT INTO "); |
|
command.append(beanDest.getQC()); |
|
command.append(convertText((String) names.get(tbIndex))); |
|
command.append(beanDest.getQC()); |
|
command.append(" values ( "); |
|
|
|
for (int i = 0; i < bean.getColumnNames().size() - 1; ++i) |
|
command.append("?,"); |
|
command.append("?)"); |
|
PreparedStatement pstm = beanDest.getConnection().prepareStatement(command.toString()); |
|
System.out.println(command); |
while((row=bean.getNextRow())!=null) |
while((row=bean.getNextRow())!=null) |
{ |
{ |
//Vector row = (Vector) result[0].get(j); |
/* //Vector row = (Vector) result[0].get(j); |
command = new StringBuffer(); |
command = new StringBuffer(); |
|
|
command.append("INSERT INTO "); |
command.append("INSERT INTO "); |
Line 223 class Convert
|
Line 236 class Convert
|
command.append(convertText((String) names.get(tbIndex))); |
command.append(convertText((String) names.get(tbIndex))); |
command.append(beanDest.getQC()); |
command.append(beanDest.getQC()); |
command.append(" values ( "); |
command.append(" values ( "); |
|
*/ |
//print rows |
//print rows |
Object obj = null; |
Object obj = null; |
|
/* |
for(int k=0;k<row.size()-1;++k) |
for(int k=0;k<row.size()-1;++k) |
{ |
{ |
obj = row.get(k); |
obj = row.get(k); |
Line 253 class Convert
|
Line 268 class Convert
|
// dialog.progress.setValue((int)(((double)(j+1)/(double)result[0].size())*100.0)); |
// dialog.progress.setValue((int)(((double)(j+1)/(double)result[0].size())*100.0)); |
// System.out.println( (int)(((double)(j+1)/(double)result[0].size())*100.0)+" "+result[0].size()+" "+j); |
// System.out.println( (int)(((double)(j+1)/(double)result[0].size())*100.0)+" "+result[0].size()+" "+j); |
command = null; |
command = null; |
|
*/ |
|
for (int k = 0; k < row.size(); ++k) |
|
{ |
|
obj = row.get(k); |
|
if (obj instanceof ArrayList) |
|
obj = ((List) obj).get(0); |
|
String str = (obj == null) ? "NULL" : obj.toString(); |
|
if (!str.equals("NULL")) |
|
pstm.setString(k + 1, str); |
|
else |
|
pstm.setNull(k + 1, Types.NULL); |
|
} |
|
pstm.execute(); |
|
|
}// to for loop |
}// to for loop |
|
|
} |
} |
Line 423 class Convert
|
Line 452 class Convert
|
//for (int j = 0; j < result[0].size(); ++j) |
//for (int j = 0; j < result[0].size(); ++j) |
int j=-1; |
int j=-1; |
Vector row = null; |
Vector row = null; |
|
command = new StringBuffer(); |
|
|
|
command.append("INSERT INTO "); |
|
command.append(beanDest.getQC()); |
|
command.append(convertText((String) names.get(tbIndex))); |
|
command.append(beanDest.getQC()); |
|
command.append(" values ( "); |
|
|
|
for(int i=0;i<bean.getColumnNames().size()-1;++i) command.append("?,"); |
|
command.append("?)"); |
|
PreparedStatement pstm = beanDest.getConnection().prepareStatement(command.toString()); |
|
System.out.println(command); |
int rowCount= bean.getRowCount(query); |
int rowCount= bean.getRowCount(query); |
while((row=bean.getNextRow())!=null) |
while((row=bean.getNextRow())!=null) |
{ |
{ |
j++; |
j++; |
// row = (Vector) result[0].get(j); |
// row = (Vector) result[0].get(j); |
command = new StringBuffer(); |
/* command = new StringBuffer(); |
|
|
command.append("INSERT INTO "); |
command.append("INSERT INTO "); |
command.append(beanDest.getQC()); |
command.append(beanDest.getQC()); |
command.append(convertText((String) names.get(tbIndex))); |
command.append(convertText((String) names.get(tbIndex))); |
command.append(beanDest.getQC()); |
command.append(beanDest.getQC()); |
command.append(" values ( "); |
command.append(" values ( "); |
|
*/ |
//print rows |
//print rows |
Object obj = null; |
Object obj = null; |
for(int k=0;k<row.size()-1;++k) |
/* for(int k=0;k<row.size()-1;++k) |
{ |
{ |
obj = row.get(k); |
obj = row.get(k); |
//System.out.println("row "+obj+" "+k); |
//System.out.println("row "+obj+" "+k); |
if(obj!=null&&!(obj instanceof ArrayList)) |
if(obj!=null&&!(obj instanceof ArrayList)) |
command.append("'"+convertUml(new String(obj.toString().getBytes("UTF-8"),"UTF-8"))+"',"); |
command.append("'"+convertUml(obj.toString())+"',"); |
else if(obj!=null&& obj instanceof ArrayList) |
else if(obj!=null&& obj instanceof ArrayList) |
command.append("'"+convertUml(((ArrayList)obj).get(0).toString())+"',"); |
command.append("'"+convertUml(((ArrayList)obj).get(0).toString())+"',"); |
else command.append("NULL,"); |
else command.append("NULL,"); |
} |
} |
obj = row.get(row.size() - 1); |
obj = row.get(row.size() - 1); |
if (obj != null && !(obj instanceof ArrayList)) |
if (obj != null && !(obj instanceof ArrayList)) |
command.append("'"+convertUml(new String(obj.toString().getBytes("UTF-8"),"UTF-8"))+"')"); |
command.append("'"+convertUml(obj.toString())+"')"); |
else |
else |
if(obj!=null&& obj instanceof ArrayList) |
if(obj!=null&& obj instanceof ArrayList) |
command.append("'"+convertUml(((ArrayList)obj).get(0).toString())+"')"); //command.append(obj.toString()+")"); |
command.append("'"+convertUml(((ArrayList)obj).get(0).toString())+"')"); //command.append(obj.toString()+")"); |
else command.append("NULL)"); |
else command.append("NULL)"); |
|
*/ |
//command.append("'"+row.get(row.size()-1)+"')"); |
//command.append("'"+row.get(row.size()-1)+"')"); |
//command.append(" )"); |
//command.append(" )"); |
// for(int k=0;k<row.size();++k) |
// for(int k=0;k<row.size();++k) |
Line 461 class Convert
|
Line 504 class Convert
|
// System.out.println(); |
// System.out.println(); |
// System.out.println(command+" "+j+" "+row.size()+" "+ ((Vector)result2[0].get(j)).size()); |
// System.out.println(command+" "+j+" "+row.size()+" "+ ((Vector)result2[0].get(j)).size()); |
// System.out.println(command); |
// System.out.println(command); |
stm.executeUpdate(command.toString()); |
for(int k=0;k<row.size();++k) |
|
{ |
|
obj = row.get(k); |
|
if(obj instanceof ArrayList) obj=((List)obj).get(0); |
|
String str =(obj==null) ? "NULL":obj.toString(); |
|
if(!str.equals("NULL")) |
|
pstm.setString(k+1,str); |
|
else pstm.setNull(k+1,Types.NULL); |
|
} |
|
pstm.execute(); |
|
//stm.executeUpdate(command.toString()); |
dialog.progress.setValue((int) (((double) (j + 1) / (double) rowCount) * 100.0)); |
dialog.progress.setValue((int) (((double) (j + 1) / (double) rowCount) * 100.0)); |
// System.out.println( (int)(((double)(j+1)/(double)result[0].size())*100.0)+" "+result[0].size()+" "+j); |
// System.out.println( (int)(((double)(j+1)/(double)result[0].size())*100.0)+" "+result[0].size()+" "+j); |
command = null; |
command = null; |
Line 492 class Convert
|
Line 545 class Convert
|
StringBuffer alterMe = new StringBuffer(newName.trim().toLowerCase()); |
StringBuffer alterMe = new StringBuffer(newName.trim().toLowerCase()); |
int length = alterMe.length(); |
int length = alterMe.length(); |
int j = 0; |
int j = 0; |
|
int index=alterMe.indexOf(".fp5"); |
|
if ( index >= 0 ) |
|
{ |
|
alterMe.delete(index, index + 4); |
|
length = length - 4; |
|
} |
|
|
while (j < length) |
while (j < length) |
{ |
{ |
if (alterMe.charAt(j) == ' ') |
if (alterMe.charAt(j) == ' ') |
Line 560 class Convert
|
Line 620 class Convert
|
alterMe.setCharAt(j, '_'); |
alterMe.setCharAt(j, '_'); |
|
|
} |
} |
|
else if (alterMe.charAt(j) == '.') |
|
{ |
|
System.out.println("dube "+alterMe); |
|
if(j==length-1) |
|
{ |
|
alterMe.delete(j, j); |
|
length--; |
|
continue; |
|
} |
|
} |
|
|
++j; |
++j; |
} |
} |