Cleanup of backpatch of jdbc2 improvements to jdbc1:
Here's what I came up with. The biggest difference api between JDK1.x and later versions is the support for collections. The problem was with the Vector class; in jdk1.x there is no method called add, so I changed the calls to addElement. Also no addAll, so I rewrote the method slightly to not require addAll. While reviewing this I notices some System.out.println statements that weren't commented out. So I commented them out in both versions. The upshot of all of this is that I have clean compile, but no idea if the code works ;( Dave Cramer
This commit is contained in:
parent
1ef5c99c85
commit
2e3c56a0ea
@ -2186,20 +2186,21 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector importLoop(java.sql.ResultSet keyRelation) throws SQLException {
|
private void importLoop(Vector tuples, java.sql.ResultSet keyRelation) throws SQLException
|
||||||
|
{
|
||||||
String s,s2;
|
String s,s2;
|
||||||
String origTable=null, primTable=new String(""), schema;
|
String origTable=null, primTable=new String(""), schema;
|
||||||
int i;
|
int i;
|
||||||
Vector v;
|
Vector v=new Vector();
|
||||||
|
|
||||||
s=keyRelation.getString(1);
|
s=keyRelation.getString(1);
|
||||||
s2=s;
|
s2=s;
|
||||||
System.out.println(s);
|
//System.out.println(s);
|
||||||
v=new Vector();
|
|
||||||
for (i=0;;i++) {
|
for (i=0;;i++) {
|
||||||
s=s.substring(s.indexOf("\\000")+4);
|
s=s.substring(s.indexOf("\\000")+4);
|
||||||
if (s.compareTo("")==0) {
|
if (s.compareTo("")==0) {
|
||||||
System.out.println();
|
//System.out.println();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
s2=s.substring(0,s.indexOf("\\000"));
|
s2=s.substring(0,s.indexOf("\\000"));
|
||||||
@ -2214,7 +2215,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
schema=s2;
|
schema=s2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
v.add(s2);
|
v.addElement(s2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2222,7 +2223,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
java.sql.ResultSetMetaData origCols=rstmp.getMetaData();
|
java.sql.ResultSetMetaData origCols=rstmp.getMetaData();
|
||||||
|
|
||||||
String stmp;
|
String stmp;
|
||||||
Vector tuples=new Vector();
|
// Vector tuples=new Vector();
|
||||||
byte tuple[][];
|
byte tuple[][];
|
||||||
|
|
||||||
// the foreign keys are only on even positions in the Vector.
|
// the foreign keys are only on even positions in the Vector.
|
||||||
@ -2248,17 +2249,17 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
//KEY_SEQ
|
//KEY_SEQ
|
||||||
tuple[8]=Integer.toString(j).getBytes();
|
tuple[8]=Integer.toString(j).getBytes();
|
||||||
|
|
||||||
tuples.add(tuple);
|
tuples.addElement(tuple);
|
||||||
|
|
||||||
System.out.println(origCols.getColumnName(j)+
|
//System.out.println(origCols.getColumnName(j)+
|
||||||
": "+j+" -> "+primTable+": "+
|
//": "+j+" -> "+primTable+": "+
|
||||||
(String)v.elementAt(i+1));
|
//(String)v.elementAt(i+1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tuples;
|
//return tuples;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2342,7 +2343,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
Vector tuples=new Vector();
|
Vector tuples=new Vector();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
tuples.addAll(importLoop(rs));
|
importLoop(tuples,rs);
|
||||||
}
|
}
|
||||||
|
|
||||||
rsret=new ResultSet(connection, f, tuples, "OK", 1);
|
rsret=new ResultSet(connection, f, tuples, "OK", 1);
|
||||||
|
@ -2194,12 +2194,12 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
s=keyRelation.getString(1);
|
s=keyRelation.getString(1);
|
||||||
s2=s;
|
s2=s;
|
||||||
System.out.println(s);
|
// System.out.println(s);
|
||||||
v=new Vector();
|
v=new Vector();
|
||||||
for (i=0;;i++) {
|
for (i=0;;i++) {
|
||||||
s=s.substring(s.indexOf("\\000")+4);
|
s=s.substring(s.indexOf("\\000")+4);
|
||||||
if (s.compareTo("")==0) {
|
if (s.compareTo("")==0) {
|
||||||
System.out.println();
|
//System.out.println();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
s2=s.substring(0,s.indexOf("\\000"));
|
s2=s.substring(0,s.indexOf("\\000"));
|
||||||
@ -2249,10 +2249,11 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
tuple[8]=Integer.toString(j).getBytes();
|
tuple[8]=Integer.toString(j).getBytes();
|
||||||
|
|
||||||
tuples.add(tuple);
|
tuples.add(tuple);
|
||||||
|
/*
|
||||||
System.out.println(origCols.getColumnName(j)+
|
System.out.println(origCols.getColumnName(j)+
|
||||||
": "+j+" -> "+primTable+": "+
|
": "+j+" -> "+primTable+": "+
|
||||||
(String)v.elementAt(i+1));
|
(String)v.elementAt(i+1));
|
||||||
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user