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

Commit3f59cc0

Browse files
author
Peter Mount
committed
Minor bug fixes. Replaced DateStyle support with ISO.
1 parentc2b75c8 commit3f59cc0

16 files changed

+188
-3923
lines changed

‎src/interfaces/jdbc/CHANGELOG

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
Mon May 17 23:40:00 BST 1999
2+
- PG_Stream.close() now attempts to send the close connection message
3+
to the backend before closing the streams
4+
- Added batch support in the JDBC2, supplied by Yutaka Tanida <yutaka@marin.or.jp>
5+
- Removed the old datestyle code. Now the driver uses only ISO.
6+
- Removed some files in the postgresql directory still in CVS that were
7+
moved since 6.4.x (DatabaseMetaData.java PreparedStatement.java
8+
ResultSetMetaData.java Statement.java)
9+
- Internationalisation of the error messages is partially implemented, however
10+
it's not enabled as it only works when the jar file is _not_ used, and
11+
work needs to be done.
12+
113
Sun Apr 11 17:00:00 BST 1999
214
- getUpdateCount() now returns the actual update count (before it
315
simply returned 1 for everything).

‎src/interfaces/jdbc/postgresql/Connection.java

Lines changed: 28 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
importpostgresql.util.*;
1111

1212
/**
13-
* $Id: Connection.java,v 1.15 1999/04/11 18:03:00 peter Exp $
13+
* $Id: Connection.java,v 1.16 1999/05/17 22:43:23 peter Exp $
1414
*
1515
* This abstract class is used by postgresql.Driver to open either the JDBC1 or
1616
* JDBC2 versions of the Connection class.
@@ -67,38 +67,6 @@ public abstract class Connection
6767
// be across all connections, which could be to different backends.
6868
publicHashtablefieldCache =newHashtable();
6969

70-
/**
71-
* This is the current date style of the backend
72-
*/
73-
publicintcurrentDateStyle;
74-
75-
/**
76-
* This defines the formats for dates, according to the various date styles.
77-
*
78-
* <p>There are two strings for each entry. The first is the string to search
79-
* for in the datestyle message, and the second the format to use.
80-
*
81-
* <p>To add a new date style, work out the format. Then with psql running
82-
* in the date style you wish to add, type: show datestyle;
83-
*
84-
* <p>eg:
85-
* <br><pre>
86-
* => show datestyle;
87-
* NOTICE: Datestyle is SQL with European conventions
88-
* ^^^^^^^^^^^^^^^^^
89-
* </pre>The marked part of the string is the first string below. The second
90-
* is your format. If a style (like ISO) ignores the US/European variants,
91-
* then you can ignore the "with" part of the string.
92-
*/
93-
protectedstaticfinalStringdateStyles[] = {
94-
"Postgres with European","dd-MM-yyyy",
95-
"Postgres with US","MM-dd-yyyy",
96-
"ISO","yyyy-MM-dd",
97-
"SQL with European","dd/MM/yyyy",
98-
"SQL with US","MM/dd/yyyy",
99-
"German","dd.MM.yyyy"
100-
};
101-
10270
// Now handle notices as warnings, so things like "show" now work
10371
publicSQLWarningfirstWarning =null;
10472

@@ -242,22 +210,24 @@ protected void openConnection(String host, int port, Properties info, String dat
242210
thrownewSQLException("Connection failed: " +e.toString());
243211
}
244212

245-
// Find out the date style by issuing the SQL: show datestyle
246-
// This actually issues a warning, and our own warning handling
247-
// code handles this itself.
248-
//
249-
// Also, this query replaced the NULL query issued to test the
250-
// connection.
251-
//
213+
// Originally we issued a SHOW DATESTYLE statement to find the databases default
214+
// datestyle. However, this caused some problems with timestamps, so in 6.5, we
215+
// went the way of ODBC, and set the connection to ISO.
216+
//
217+
// This may cause some clients to break when they assume anything other than ISO,
218+
// but then - they should be using the proper methods ;-)
219+
//
220+
//
252221
firstWarning =null;
253-
ExecSQL("show datestyle");
254-
255-
// Initialise object handling
256-
initObjectTypes();
257-
258-
// Mark the connection as ok, and cleanup
222+
223+
ExecSQL("set datestyle to 'ISO'");
224+
225+
// Initialise object handling
226+
initObjectTypes();
227+
228+
// Mark the connection as ok, and cleanup
259229
firstWarning =null;
260-
PG_STATUS =CONNECTION_OK;
230+
PG_STATUS =CONNECTION_OK;
261231
}
262232

263233
// These methods used to be in the main Connection implementation. As they
@@ -280,23 +250,18 @@ public void addWarning(String msg)
280250

281251
// Now check for some specific messages
282252

253+
// This is obsolete in 6.5, but I've left it in here so if we need to use this
254+
// technique again, we'll know where to place it.
255+
//
283256
// This is generated by the SQL "show datestyle"
284-
if(msg.startsWith("NOTICE:") &&msg.indexOf("DateStyle")>0) {
285-
// 13 is the length off "DateStyle is "
286-
msg =msg.substring(msg.indexOf("DateStyle is ")+13);
287-
288-
for(inti=0;i<dateStyles.length;i+=2)
289-
if(msg.startsWith(dateStyles[i]))
290-
currentDateStyle=i+1;// this is the index of the format
291-
}
292-
}
293-
294-
/**
295-
* @return the date format for the current date style of the backend
296-
*/
297-
publicStringgetDateStyle()
298-
{
299-
returndateStyles[currentDateStyle];
257+
//if(msg.startsWith("NOTICE:") && msg.indexOf("DateStyle")>0) {
258+
//// 13 is the length off "DateStyle is "
259+
//msg = msg.substring(msg.indexOf("DateStyle is ")+13);
260+
//
261+
//for(int i=0;i<dateStyles.length;i+=2)
262+
//if(msg.startsWith(dateStyles[i]))
263+
//currentDateStyle=i+1; // this is the index of the format
264+
//}
300265
}
301266

302267
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp