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

Commite8f7bfc

Browse files
committed
Here's a resend of the patch.gz. I gunzip'ed it fine here
so it may be a transit problem. Also removed the 'txt' suffixin case that was confusing some transport layer trying to betoo inteligent for our own good.This may have been because the Array.java class from theprevious patch didn't seem to have made it into the snapshotbuild for some reason. This patch should at least fix that issue.Greg Zoller
1 parentb04e3a2 commite8f7bfc

File tree

3 files changed

+36
-31
lines changed

3 files changed

+36
-31
lines changed

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

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@
2525

2626
publicclassArrayimplementsjava.sql.Array
2727
{
28-
privateorg.postgresql.Connectionconn =null;
29-
privateorg.postgresql.Fieldfield =null;
30-
privateorg.postgresql.jdbc2.ResultSetrs =null;
31-
privateintidx =0;
28+
privateorg.postgresql.Connectionconn =null;
29+
privateorg.postgresql.Fieldfield =null;
30+
privateorg.postgresql.jdbc2.ResultSetrs =null;
31+
privateintidx =0;
32+
privateStringrawString =null;
3233

3334
/**
3435
* Create a new Array
@@ -38,11 +39,14 @@ public class Array implements java.sql.Array
3839
* @param field the Field descriptor for the field to load into this Array
3940
* @param rs the ResultSet from which to get the data for this Array
4041
*/
41-
publicArray(org.postgresql.Connectionconn,intidx,Fieldfield,org.postgresql.jdbc2.ResultSetrs ) {
42+
publicArray(org.postgresql.Connectionconn,intidx,Fieldfield,org.postgresql.jdbc2.ResultSetrs )
43+
throwsSQLException
44+
{
4245
this.conn =conn;
4346
this.field =field;
4447
this.rs =rs;
4548
this.idx =idx;
49+
this.rawString =rs.getFixedString(idx);
4650
}
4751

4852
publicObjectgetArray()throwsSQLException {
@@ -66,9 +70,8 @@ public Object getArray(long index, int count, Map map) throws SQLException {
6670
ObjectretVal =null;
6771

6872
ArrayListarray =newArrayList();
69-
Stringraw =rs.getFixedString(idx);
70-
if(raw !=null ) {
71-
char[]chars =raw.toCharArray();
73+
if(rawString !=null ) {
74+
char[]chars =rawString.toCharArray();
7275
StringBuffersbuf =newStringBuffer();
7376
booleanfoundOpen =false;
7477
booleaninsideString =false;
@@ -200,8 +203,8 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
200203
fields[1] =newField(conn,"VALUE",field.getOID("bool"),1);
201204
for(inti=0;i<booleanArray.length;i++ ) {
202205
byte[][]tuple =newbyte[2][0];
203-
tuple[0] =Integer.toString((int)index+i).getBytes();// Index
204-
tuple[1] =(booleanArray[i]?"YES":"NO").getBytes();// Value
206+
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i));// Index
207+
tuple[1] =conn.getEncoding().encode( (booleanArray[i]?"YES":"NO"));// Value
205208
rows.addElement(tuple);
206209
}
207210
caseTypes.SMALLINT:
@@ -212,8 +215,8 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
212215
fields[1] =newField(conn,"VALUE",field.getOID("int4"),4);
213216
for(inti=0;i<intArray.length;i++ ) {
214217
byte[][]tuple =newbyte[2][0];
215-
tuple[0] =Integer.toString((int)index+i).getBytes();// Index
216-
tuple[1] =Integer.toString(intArray[i]).getBytes();// Value
218+
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i));// Index
219+
tuple[1] =conn.getEncoding().encode(Integer.toString(intArray[i]));// Value
217220
rows.addElement(tuple);
218221
}
219222
break;
@@ -222,8 +225,8 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
222225
fields[1] =newField(conn,"VALUE",field.getOID("int8"),8);
223226
for(inti=0;i<longArray.length;i++ ) {
224227
byte[][]tuple =newbyte[2][0];
225-
tuple[0] =Integer.toString((int)index+i).getBytes();// Index
226-
tuple[1] =Long.toString(longArray[i]).getBytes();// Value
228+
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i));// Index
229+
tuple[1] =conn.getEncoding().encode(Long.toString(longArray[i]));// Value
227230
rows.addElement(tuple);
228231
}
229232
break;
@@ -232,8 +235,8 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
232235
fields[1] =newField(conn,"VALUE",field.getOID("numeric"), -1);
233236
for(inti=0;i<bdArray.length;i++ ) {
234237
byte[][]tuple =newbyte[2][0];
235-
tuple[0] =Integer.toString((int)index+i).getBytes();// Index
236-
tuple[1] =bdArray[i].toString().getBytes();// Value
238+
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i));// Index
239+
tuple[1] =conn.getEncoding().encode(bdArray[i].toString());// Value
237240
rows.addElement(tuple);
238241
}
239242
break;
@@ -242,8 +245,8 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
242245
fields[1] =newField(conn,"VALUE",field.getOID("float4"),4);
243246
for(inti=0;i<floatArray.length;i++ ) {
244247
byte[][]tuple =newbyte[2][0];
245-
tuple[0] =Integer.toString((int)index+i).getBytes();// Index
246-
tuple[1] =Float.toString(floatArray[i]).getBytes();// Value
248+
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i));// Index
249+
tuple[1] =conn.getEncoding().encode(Float.toString(floatArray[i]));// Value
247250
rows.addElement(tuple);
248251
}
249252
break;
@@ -252,8 +255,8 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
252255
fields[1] =newField(conn,"VALUE",field.getOID("float8"),8);
253256
for(inti=0;i<doubleArray.length;i++ ) {
254257
byte[][]tuple =newbyte[2][0];
255-
tuple[0] =Integer.toString((int)index+i).getBytes();// Index
256-
tuple[1] =Double.toString(doubleArray[i]).getBytes();// Value
258+
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i));// Index
259+
tuple[1] =conn.getEncoding().encode(Double.toString(doubleArray[i]));// Value
257260
rows.addElement(tuple);
258261
}
259262
break;
@@ -265,8 +268,8 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
265268
fields[1] =newField(conn,"VALUE",field.getOID("varchar"), -1);
266269
for(inti=0;i<strArray.length;i++ ) {
267270
byte[][]tuple =newbyte[2][0];
268-
tuple[0] =Integer.toString((int)index+i).getBytes();// Index
269-
tuple[1] =strArray[i].getBytes();// Value
271+
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i));// Index
272+
tuple[1] =conn.getEncoding().encode(strArray[i]);// Value
270273
rows.addElement(tuple);
271274
}
272275
break;
@@ -275,8 +278,8 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
275278
fields[1] =newField(conn,"VALUE",field.getOID("date"),4);
276279
for(inti=0;i<dateArray.length;i++ ) {
277280
byte[][]tuple =newbyte[2][0];
278-
tuple[0] =Integer.toString((int)index+i).getBytes();// Index
279-
tuple[1] =dateArray[i].toString().getBytes();// Value
281+
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i));// Index
282+
tuple[1] =conn.getEncoding().encode(dateArray[i].toString());// Value
280283
rows.addElement(tuple);
281284
}
282285
break;
@@ -285,8 +288,8 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
285288
fields[1] =newField(conn,"VALUE",field.getOID("time"),8);
286289
for(inti=0;i<timeArray.length;i++ ) {
287290
byte[][]tuple =newbyte[2][0];
288-
tuple[0] =Integer.toString((int)index+i).getBytes();// Index
289-
tuple[1] =timeArray[i].toString().getBytes();// Value
291+
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i));// Index
292+
tuple[1] =conn.getEncoding().encode(timeArray[i].toString());// Value
290293
rows.addElement(tuple);
291294
}
292295
break;
@@ -295,8 +298,8 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
295298
fields[1] =newField(conn,"VALUE",field.getOID("timestamp"),8);
296299
for(inti=0;i<timestampArray.length;i++ ) {
297300
byte[][]tuple =newbyte[2][0];
298-
tuple[0] =Integer.toString((int)index+i).getBytes();// Index
299-
tuple[1] =timestampArray[i].toString().getBytes();// Value
301+
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i));// Index
302+
tuple[1] =conn.getEncoding().encode(timestampArray[i].toString());// Value
300303
rows.addElement(tuple);
301304
}
302305
break;
@@ -308,5 +311,7 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
308311
}
309312
returnnewResultSet((org.postgresql.jdbc2.Connection)conn,fields,rows,"OK",1 );
310313
}
314+
315+
publicStringtoString() {returnrawString; }
311316
}
312317

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public Object getObject(int parameterIndex)
308308

309309
// ** JDBC 2 Extensions **
310310

311-
publicArraygetArray(inti)throwsSQLException
311+
publicjava.sql.ArraygetArray(inti)throwsSQLException
312312
{
313313
throworg.postgresql.Driver.notImplemented();
314314
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,9 +698,9 @@ public java.sql.ResultSetMetaData getMetaData() throws SQLException
698698
returnnull;
699699
}
700700

701-
publicvoidsetArray(inti,Arrayx)throwsSQLException
701+
publicvoidsetArray(inti,java.sql.Arrayx)throwsSQLException
702702
{
703-
throworg.postgresql.Driver.notImplemented();
703+
setString(i,x.toString());
704704
}
705705

706706
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp