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

Commit2232172

Browse files
author
Barry Lind
committed
JDBC checkin fixing the following bugs:
Fixed support in the driver for notifications (added PGConnection.getNotifications()) - problem reported by Benjamin.Feinstein@guardent.com Worked around server problems with int8/int2 and constants; quote values when they are intended to bind to an int8/int2 column - reported by many Fixed bug in the Array interface with string parsing not handling escaped characters correctly - reported by devajx@yahoo.com Added workaround to support 'infinity' and '-infinity' for dates - reported bydmitry@openratings.com Fixed some performance issues with setBlob - reported by d.wall@computer.org Added support for using new prepared statements functionality in 7.3 (added PGStatement.setUseServerPrepare() and isUseServerPrepare() methods) Modified Files: jdbc/org/postgresql/PGConnection.java jdbc/org/postgresql/PGStatement.java jdbc/org/postgresql/core/QueryExecutor.java jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java jdbc/org/postgresql/jdbc2/Array.java Added Files: jdbc/org/postgresql/PGNotification.java jdbc/org/postgresql/core/Notification.java
1 parent97ac103 commit2232172

File tree

10 files changed

+243
-40
lines changed

10 files changed

+243
-40
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
importorg.postgresql.fastpath.Fastpath;
88
importorg.postgresql.largeobject.LargeObjectManager;
99

10-
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGConnection.java,v 1.1 2002/07/23 03:59:55 barry Exp $
10+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGConnection.java,v 1.2 2002/09/02 03:07:36 barry Exp $
1111
* This interface defines PostgreSQL extentions to the java.sql.Connection interface.
1212
* Any java.sql.Connection object returned by the driver will also implement this
1313
* interface
@@ -68,5 +68,14 @@ public interface PGConnection
6868
*/
6969
publicObjectgetObject(Stringtype,Stringvalue)throwsSQLException;
7070

71+
72+
/*
73+
* This method returns any notifications that have been received
74+
* since the last call to this method.
75+
* Returns null if there have been no notifications.
76+
*/
77+
publicPGNotification[]getNotifications();
78+
79+
7180
}
7281

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
packageorg.postgresql;
2+
3+
4+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGNotification.java,v 1.1 2002/09/02 03:07:36 barry Exp $
5+
* This interface defines PostgreSQL extention for Notifications
6+
*/
7+
publicinterfacePGNotification
8+
{
9+
/*
10+
* Returns name of this notification
11+
*/
12+
publicStringgetName();
13+
14+
/*
15+
* Returns the process id of the backend process making this notification
16+
*/
17+
publicintgetPID();
18+
19+
}
20+

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
importjava.sql.*;
55

6-
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGStatement.java,v 1.3 2002/07/23 03:59:55 barry Exp $
6+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGStatement.java,v 1.4 2002/09/02 03:07:36 barry Exp $
77
* This interface defines PostgreSQL extentions to the java.sql.Statement interface.
88
* Any java.sql.Statement object returned by the driver will also implement this
99
* interface
@@ -18,4 +18,8 @@ public interface PGStatement
1818
*/
1919
publiclonggetLastOID()throwsSQLException;
2020

21+
publicvoidsetUseServerPrepare(booleanflag);
22+
23+
publicbooleanisUseServerPrepare();
24+
2125
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
packageorg.postgresql.core;
2+
3+
4+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Notification.java,v 1.1 2002/09/02 03:07:36 barry Exp $
5+
* This is the implementation of the PGNotification interface
6+
*/
7+
publicclassNotificationimplementsorg.postgresql.PGNotification
8+
{
9+
publicNotification(Stringp_name,intp_pid) {
10+
m_name =p_name;
11+
m_pid =p_pid;
12+
}
13+
14+
/*
15+
* Returns name of this notification
16+
*/
17+
publicStringgetName() {
18+
returnm_name;
19+
}
20+
21+
/*
22+
* Returns the process id of the backend process making this notification
23+
*/
24+
publicintgetPID() {
25+
returnm_pid;
26+
}
27+
28+
privateStringm_name;
29+
privateintm_pid;
30+
31+
}
32+

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* <p>The lifetime of a QueryExecutor object is from sending the query
1414
* until the response has been received from the backend.
1515
*
16-
* $Id: QueryExecutor.java,v 1.14 2002/08/23 20:45:49 barry Exp $
16+
* $Id: QueryExecutor.java,v 1.15 2002/09/02 03:07:36 barry Exp $
1717
*/
1818

1919
publicclassQueryExecutor
@@ -75,6 +75,7 @@ public java.sql.ResultSet execute() throws SQLException
7575
case'A':// Asynchronous Notify
7676
intpid =pg_stream.ReceiveInteger(4);
7777
Stringmsg =pg_stream.ReceiveString(connection.getEncoding());
78+
connection.addNotification(neworg.postgresql.core.Notification(msg,pid));
7879
break;
7980
case'B':// Binary Data Transfer
8081
receiveTuple(true);

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
importjava.sql.*;
77
importjava.util.*;
88
importorg.postgresql.Driver;
9+
importorg.postgresql.PGNotification;
910
importorg.postgresql.PG_Stream;
1011
importorg.postgresql.core.*;
1112
importorg.postgresql.fastpath.Fastpath;
1213
importorg.postgresql.largeobject.LargeObjectManager;
1314
importorg.postgresql.util.*;
1415

1516

16-
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.6 2002/09/01 23:56:13 davec Exp $
17+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.7 2002/09/02 03:07:36 barry Exp $
1718
* This class defines methods of the jdbc1 specification. This class is
1819
* extended by org.postgresql.jdbc2.AbstractJdbc2Connection which adds the jdbc2
1920
* methods. The real Connection class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Connection
@@ -34,6 +35,8 @@ public abstract class AbstractJdbc1Connection implements org.postgresql.PGConnec
3435
protectedintpid;
3536
protectedintckey;
3637

38+
privateVectorm_notifications;
39+
3740
/*
3841
The encoding to use for this connection.
3942
*/
@@ -1309,7 +1312,22 @@ public int getSQLType(String pgTypeName)
13091312
Types.TIMESTAMP,Types.TIMESTAMP,Types.TIMESTAMP
13101313
};
13111314

1312-
1315+
//Methods to support postgres notifications
1316+
publicvoidaddNotification(org.postgresql.PGNotificationp_notification) {
1317+
if (m_notifications ==null)
1318+
m_notifications =newVector();
1319+
m_notifications.addElement(p_notification);
1320+
}
1321+
1322+
publicPGNotification[]getNotifications() {
1323+
PGNotification[]l_return =null;
1324+
if (m_notifications !=null) {
1325+
l_return =newPGNotification[m_notifications.size()];
1326+
m_notifications.copyInto(l_return);
1327+
}
1328+
m_notifications =null;
1329+
returnl_return;
1330+
}
13131331
}
13141332

13151333

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
importorg.postgresql.util.PGbytea;
1414
importorg.postgresql.util.PSQLException;
1515

16-
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.4 2002/08/16 17:51:38 barry Exp $
16+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.5 2002/09/02 03:07:36 barry Exp $
1717
* This class defines methods of the jdbc1 specification. This class is
1818
* extended by org.postgresql.jdbc2.AbstractJdbc2ResultSet which adds the jdbc2
1919
* methods. The real ResultSet class (for jdbc1) is org.postgresql.jdbc1.Jdbc1ResultSet
@@ -934,6 +934,15 @@ else if (slen == 19)
934934
}
935935
else
936936
{
937+
if (slen ==8 &&s.equals("infinity"))
938+
//java doesn't have a concept of postgres's infinity
939+
//so set to an arbitrary future date
940+
s ="9999-01-01";
941+
if (slen ==9 &&s.equals("-infinity"))
942+
//java doesn't have a concept of postgres's infinity
943+
//so set to an arbitrary old date
944+
s ="0001-01-01";
945+
937946
// We must just have a date. This case is
938947
// needed if this method is called on a date
939948
// column

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp