Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2e3c56a

Browse files
committed
Cleanup of backpatch of jdbc2 improvements to jdbc1:
Here's what I came up with. The biggest difference api between JDK1.x andlater versions is the support for collections. The problem was with theVector class; in jdk1.x there is no method called add, so I changed thecalls to addElement. Also no addAll, so I rewrote the method slightly to notrequire addAll. While reviewing this I notices some System.out.printlnstatements that weren't commented out. So I commented them out in bothversions.The upshot of all of this is that I have clean compile, but no idea if thecode works ;(Dave Cramer
1 parent1ef5c99 commit2e3c56a

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

‎src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2186,20 +2186,21 @@ public java.sql.ResultSet getPrimaryKeys(String catalog, String schema, String t
21862186
);
21872187
}
21882188

2189-
privateVectorimportLoop(java.sql.ResultSetkeyRelation)throwsSQLException {
2189+
privatevoidimportLoop(Vectortuples,java.sql.ResultSetkeyRelation)throwsSQLException
2190+
{
21902191
Strings,s2;
21912192
StringorigTable=null,primTable=newString(""),schema;
21922193
inti;
2193-
Vectorv;
2194+
Vectorv=newVector();
21942195

21952196
s=keyRelation.getString(1);
21962197
s2=s;
2197-
System.out.println(s);
2198-
v=newVector();
2198+
//System.out.println(s);
2199+
21992200
for (i=0;;i++) {
22002201
s=s.substring(s.indexOf("\\000")+4);
22012202
if (s.compareTo("")==0) {
2202-
System.out.println();
2203+
//System.out.println();
22032204
break;
22042205
}
22052206
s2=s.substring(0,s.indexOf("\\000"));
@@ -2214,15 +2215,15 @@ private Vector importLoop(java.sql.ResultSet keyRelation) throws SQLException {
22142215
schema=s2;
22152216
break;
22162217
default:
2217-
v.add(s2);
2218+
v.addElement(s2);
22182219
}
22192220
}
22202221

22212222
java.sql.ResultSetrstmp=connection.ExecSQL("select * from "+origTable+" where 1=0");
22222223
java.sql.ResultSetMetaDataorigCols=rstmp.getMetaData();
22232224

22242225
Stringstmp;
2225-
Vectortuples=newVector();
2226+
//Vector tuples=new Vector();
22262227
bytetuple[][];
22272228

22282229
// the foreign keys are only on even positions in the Vector.
@@ -2248,17 +2249,17 @@ private Vector importLoop(java.sql.ResultSet keyRelation) throws SQLException {
22482249
//KEY_SEQ
22492250
tuple[8]=Integer.toString(j).getBytes();
22502251

2251-
tuples.add(tuple);
2252+
tuples.addElement(tuple);
22522253

2253-
System.out.println(origCols.getColumnName(j)+
2254-
": "+j+" -> "+primTable+": "+
2255-
(String)v.elementAt(i+1));
2254+
//System.out.println(origCols.getColumnName(j)+
2255+
//": "+j+" -> "+primTable+": "+
2256+
//(String)v.elementAt(i+1));
22562257
break;
22572258
}
22582259
}
22592260
}
22602261

2261-
returntuples;
2262+
//return tuples;
22622263
}
22632264

22642265

@@ -2342,7 +2343,7 @@ public java.sql.ResultSet getImportedKeys(String catalog, String schema, String
23422343
Vectortuples=newVector();
23432344

23442345
while (rs.next()) {
2345-
tuples.addAll(importLoop(rs));
2346+
importLoop(tuples,rs);
23462347
}
23472348

23482349
rsret=newResultSet(connection,f,tuples,"OK",1);

‎src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,12 +2194,12 @@ private Vector importLoop(java.sql.ResultSet keyRelation) throws SQLException {
21942194

21952195
s=keyRelation.getString(1);
21962196
s2=s;
2197-
System.out.println(s);
2197+
//System.out.println(s);
21982198
v=newVector();
21992199
for (i=0;;i++) {
22002200
s=s.substring(s.indexOf("\\000")+4);
22012201
if (s.compareTo("")==0) {
2202-
System.out.println();
2202+
//System.out.println();
22032203
break;
22042204
}
22052205
s2=s.substring(0,s.indexOf("\\000"));
@@ -2249,10 +2249,11 @@ private Vector importLoop(java.sql.ResultSet keyRelation) throws SQLException {
22492249
tuple[8]=Integer.toString(j).getBytes();
22502250

22512251
tuples.add(tuple);
2252-
2252+
/*
22532253
System.out.println(origCols.getColumnName(j)+
22542254
": "+j+" -> "+primTable+": "+
22552255
(String)v.elementAt(i+1));
2256+
*/
22562257
break;
22572258
}
22582259
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp