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

Commita9983ab

Browse files
author
Barry Lind
committed
Initial attempt to integrate in V3 protocol support. This is still a work in
progress, although all RTs pass using the V3 protocol on a 7.4 database and also pass using the V2 protocol on a 7.3 database.SSL support is known not to work. Modified Files: jdbc/org/postgresql/PGConnection.java jdbc/org/postgresql/errors.properties jdbc/org/postgresql/core/BaseConnection.java jdbc/org/postgresql/core/Encoding.java jdbc/org/postgresql/core/Field.java jdbc/org/postgresql/core/PGStream.java jdbc/org/postgresql/core/QueryExecutor.java jdbc/org/postgresql/core/StartupPacket.java jdbc/org/postgresql/fastpath/Fastpath.java jdbc/org/postgresql/fastpath/FastpathArg.java jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java jdbc/org/postgresql/test/jdbc2/BlobTest.java jdbc/org/postgresql/test/jdbc2/CallableStmtTest.java jdbc/org/postgresql/test/jdbc2/MiscTest.java jdbc/org/postgresql/test/jdbc3/Jdbc3TestSuite.java
1 parentd998fac commita9983ab

File tree

14 files changed

+841
-82
lines changed

14 files changed

+841
-82
lines changed

‎src/interfaces/jdbc/org/postgresql/PGConnection.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99
* Copyright (c) 2003, PostgreSQL Global Development Group
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGConnection.java,v 1.5 2003/04/14 10:39:51 davec Exp $
12+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGConnection.java,v 1.6 2003/05/29 03:21:32 barry Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
1616
packageorg.postgresql;
1717

1818
importjava.sql.*;
19-
importjava.util.Properties;
20-
importjava.util.Vector;
2119
importorg.postgresql.core.Encoding;
2220
importorg.postgresql.fastpath.Fastpath;
2321
importorg.postgresql.largeobject.LargeObjectManager;

‎src/interfaces/jdbc/org/postgresql/core/BaseConnection.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
* Copyright (c) 2003, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/BaseConnection.java,v 1.2 2003/04/13 04:10:07 barry Exp $
9+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/BaseConnection.java,v 1.3 2003/05/29 03:21:32 barry Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
1313
packageorg.postgresql.core;
1414

1515
importjava.sql.DatabaseMetaData;
16-
importjava.sql.ResultSet;
1716
importjava.sql.Statement;
1817
importjava.sql.SQLException;
1918
importorg.postgresql.PGConnection;
@@ -32,6 +31,8 @@ public interface BaseConnection extends PGConnection
3231
publicEncodinggetEncoding()throwsSQLException;
3332
publicDatabaseMetaDatagetMetaData()throwsSQLException;
3433
publicObjectgetObject(Stringtype,Stringvalue)throwsSQLException;
34+
publicintgetPGProtocolVersionMajor();
35+
publicintgetPGProtocolVersionMinor();
3536
publicPGStreamgetPGStream();
3637
publicStringgetPGType(intoid)throwsSQLException;
3738
publicintgetPGType(StringpgTypeName)throwsSQLException;

‎src/interfaces/jdbc/org/postgresql/core/Encoding.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2003, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Encoding.java,v 1.10 2003/03/07 18:39:41 barry Exp $
9+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Encoding.java,v 1.11 2003/05/29 03:21:32 barry Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -140,15 +140,22 @@ public String name()
140140
*/
141141
publicbyte[]encode(Strings)throwsSQLException
142142
{
143+
byte[]l_return;
143144
try
144145
{
145146
if (encoding ==null)
146147
{
147-
returns.getBytes();
148+
l_return =s.getBytes();
148149
}
149150
else
150151
{
151-
returns.getBytes(encoding);
152+
l_return =s.getBytes(encoding);
153+
}
154+
//Don't return null, return an empty byte[] instead
155+
if (l_return ==null) {
156+
returnnewbyte[0];
157+
}else {
158+
returnl_return;
152159
}
153160
}
154161
catch (UnsupportedEncodingExceptione)

‎src/interfaces/jdbc/org/postgresql/core/Field.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@
66
* Copyright (c) 2003, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Field.java,v 1.1 2003/03/07 18:39:41 barry Exp $
9+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Field.java,v 1.2 2003/05/29 03:21:32 barry Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
1313
packageorg.postgresql.core;
1414

15-
importjava.lang.*;
1615
importjava.sql.*;
17-
importjava.util.*;
1816
importorg.postgresql.core.BaseConnection;
19-
importorg.postgresql.util.PSQLException;
2017

2118
/*
2219
*/

‎src/interfaces/jdbc/org/postgresql/core/PGStream.java

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (c) 2003, PostgreSQL Global Development Group
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/PGStream.java,v 1.1 2003/03/07 18:39:41 barry Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/PGStream.java,v 1.2 2003/05/29 03:21:32 barry Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -84,6 +84,25 @@ public void SendInteger(int val, int siz) throws IOException
8484
Send(buf);
8585
}
8686

87+
/*
88+
* Sends an integer to the back end
89+
*
90+
* @param val the integer to be sent
91+
* @param siz the length of the integer in bytes (size of structure)
92+
* @exception IOException if an I/O error occurs
93+
*/
94+
publicvoidSendIntegerR(intval,intsiz)throwsIOException
95+
{
96+
byte[]buf =newbyte[siz];
97+
98+
for (inti =0;i <siz;i++)
99+
{
100+
buf[i] = (byte)(val &0xff);
101+
val >>=8;
102+
}
103+
Send(buf);
104+
}
105+
87106
/*
88107
* Send an array of bytes to the backend
89108
*
@@ -273,7 +292,39 @@ else if (c == 0)
273292
*an array of strings
274293
* @exception SQLException if a data I/O error occurs
275294
*/
276-
publicbyte[][]ReceiveTuple(intnf,booleanbin)throwsSQLException
295+
publicbyte[][]ReceiveTupleV3(intnf,booleanbin)throwsSQLException
296+
{
297+
//TODO: use l_msgSize
298+
intl_msgSize =ReceiveIntegerR(4);
299+
inti;
300+
intl_nf =ReceiveIntegerR(2);
301+
byte[][]answer =newbyte[l_nf][0];
302+
303+
for (i =0 ;i <l_nf ; ++i)
304+
{
305+
intl_size =ReceiveIntegerR(4);
306+
booleanisNull =l_size == -1;
307+
if (isNull)
308+
answer[i] =null;
309+
else
310+
{
311+
answer[i] =Receive(l_size);
312+
}
313+
}
314+
returnanswer;
315+
}
316+
317+
/*
318+
* Read a tuple from the back end.A tuple is a two dimensional
319+
* array of bytes
320+
*
321+
* @param nf the number of fields expected
322+
* @param bin true if the tuple is a binary tuple
323+
* @return null if the current response has no more tuples, otherwise
324+
*an array of strings
325+
* @exception SQLException if a data I/O error occurs
326+
*/
327+
publicbyte[][]ReceiveTupleV2(intnf,booleanbin)throwsSQLException
277328
{
278329
inti,bim = (nf +7) /8;
279330
byte[]bitmask =Receive(bim);
@@ -313,7 +364,7 @@ public byte[][] ReceiveTuple(int nf, boolean bin) throws SQLException
313364
* @return array of bytes received
314365
* @exception SQLException if a data I/O error occurs
315366
*/
316-
privatebyte[]Receive(intsiz)throwsSQLException
367+
publicbyte[]Receive(intsiz)throwsSQLException
317368
{
318369
byte[]answer =newbyte[siz];
319370
Receive(answer,0,siz);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp