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

Commit3d21bf8

Browse files
author
Peter Mount
committed
Some more including the patch to DatabaseMetaData backed out by Bruce.
Tue Feb 13 16:33:00 GMT 2001 peter@retep.org.uk - More TestCases implemented. Refined the test suite api's. - Removed need for SimpleDateFormat in ResultSet.getDate() improving performance. - Rewrote ResultSet.getTime() so that it uses JDK api's better.Tue Feb 13 10:25:00 GMT 2001 peter@retep.org.uk - Added MiscTest to hold reported problems from users. - Fixed PGMoney. - JBuilder4/JDBCExplorer now works with Money fields. Patched Field & ResultSet (lots of methods) for this one. Also changed cash/money to return type DOUBLE not DECIMAL. This broke JBuilder as zero scale BigDecimal's can't have decimal places! - When a Statement is reused, the previous ResultSet is now closed. - Removed deprecated call in ResultSet.getTime()Thu Feb 08 18:53:00 GMT 2001 peter@retep.org.uk - Changed a couple of settings in DatabaseMetaData where 7.1 now supports those features - Implemented the DatabaseMetaData TestCase.Wed Feb 07 18:06:00 GMT 2001 peter@retep.org.uk - Added comment to Connection.isClosed() explaining why we deviate from the JDBC2 specification. - Fixed bug where the Isolation Level is lost while in autocommit mode. - Fixed bug where several calls to getTransactionIsolationLevel() returned the first call's result.
1 parent2410963 commit3d21bf8

17 files changed

+1149
-103
lines changed

‎src/interfaces/jdbc/CHANGELOG

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
Tue Feb 13 16:33:00 GMT 2001 peter@retep.org.uk
2+
- More TestCases implemented. Refined the test suite api's.
3+
- Removed need for SimpleDateFormat in ResultSet.getDate() improving
4+
performance.
5+
- Rewrote ResultSet.getTime() so that it uses JDK api's better.
6+
7+
Tue Feb 13 10:25:00 GMT 2001 peter@retep.org.uk
8+
- Added MiscTest to hold reported problems from users.
9+
- Fixed PGMoney.
10+
- JBuilder4/JDBCExplorer now works with Money fields. Patched Field &
11+
ResultSet (lots of methods) for this one. Also changed cash/money to
12+
return type DOUBLE not DECIMAL. This broke JBuilder as zero scale
13+
BigDecimal's can't have decimal places!
14+
- When a Statement is reused, the previous ResultSet is now closed.
15+
- Removed deprecated call in ResultSet.getTime()
16+
17+
Thu Feb 08 18:53:00 GMT 2001 peter@retep.org.uk
18+
- Changed a couple of settings in DatabaseMetaData where 7.1 now
19+
supports those features
20+
- Implemented the DatabaseMetaData TestCase.
21+
22+
Wed Feb 07 18:06:00 GMT 2001 peter@retep.org.uk
23+
- Added comment to Connection.isClosed() explaining why we deviate from
24+
the JDBC2 specification.
25+
- Fixed bug where the Isolation Level is lost while in autocommit mode.
26+
- Fixed bug where several calls to getTransactionIsolationLevel()
27+
returned the first call's result.
28+
129
Tue Feb 06 19:00:00 GMT 2001 peter@retep.org.uk
230
- Completed first two TestCase's for the test suite. JUnit is now
331
recognised by ant.

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public class Field
1616
publicintoid;// OID of the type
1717
publicintmod;// type modifier of this field
1818
publicStringname;// Name of this field
19-
19+
2020
protectedConnectionconn;// Connection Instantation
21-
21+
2222
publicintsql_type = -1;// The entry in java.sql.Types for this field
2323
publicStringtype_name =null;// The sql type name
24-
24+
2525
/**
2626
* Construct a field based on the information fed to it.
2727
*
@@ -38,7 +38,7 @@ public Field(Connection conn, String name, int oid, int length,int mod)
3838
this.length =length;
3939
this.mod =mod;
4040
}
41-
41+
4242
/**
4343
* Constructor without mod parameter.
4444
*
@@ -51,15 +51,15 @@ public Field(Connection conn, String name, int oid, int length)
5151
{
5252
this(conn,name,oid,length,0);
5353
}
54-
54+
5555
/**
5656
* @return the oid of this Field's data type
5757
*/
5858
publicintgetOID()
5959
{
6060
returnoid;
6161
}
62-
62+
6363
/**
6464
* the ResultSet and ResultMetaData both need to handle the SQL
6565
* type, which is gained from another query. Note that we cannot
@@ -72,7 +72,7 @@ public int getSQLType() throws SQLException
7272
{
7373
if(sql_type == -1) {
7474
type_name = (String)conn.fieldCache.get(newInteger(oid));
75-
75+
7676
// it's not in the cache, so perform a query, and add the result to
7777
// the cache
7878
if(type_name==null) {
@@ -84,12 +84,12 @@ public int getSQLType() throws SQLException
8484
conn.fieldCache.put(newInteger(oid),type_name);
8585
result.close();
8686
}
87-
87+
8888
sql_type =getSQLType(type_name);
8989
}
9090
returnsql_type;
9191
}
92-
92+
9393
/**
9494
* This returns the SQL type. It is called by the Field and DatabaseMetaData classes
9595
* @param type_name PostgreSQL type name
@@ -103,7 +103,7 @@ public static int getSQLType(String type_name)
103103
sql_type=typei[i];
104104
returnsql_type;
105105
}
106-
106+
107107
/**
108108
* This table holds the org.postgresql names for the types supported.
109109
* Any types that map to Types.OTHER (eg POINT) don't go into this table.
@@ -128,7 +128,7 @@ public static int getSQLType(String type_name)
128128
"time",
129129
"abstime","timestamp"
130130
};
131-
131+
132132
/**
133133
* This table holds the JDBC type for each entry above.
134134
*
@@ -140,7 +140,7 @@ public static int getSQLType(String type_name)
140140
Types.SMALLINT,
141141
Types.INTEGER,Types.INTEGER,
142142
Types.BIGINT,
143-
Types.DECIMAL,Types.DECIMAL,
143+
Types.DOUBLE,Types.DOUBLE,
144144
Types.NUMERIC,
145145
Types.REAL,
146146
Types.DOUBLE,
@@ -151,7 +151,7 @@ public static int getSQLType(String type_name)
151151
Types.TIME,
152152
Types.TIMESTAMP,Types.TIMESTAMP
153153
};
154-
154+
155155
/**
156156
* We also need to get the type name as returned by the back end.
157157
* This is held in type_name AFTER a call to getSQLType. Since

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

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ public abstract class ResultSet
2525
protectedConnectionconnection;// the connection which we returned from
2626
protectedSQLWarningwarnings =null;// The warning chain
2727
protectedbooleanwasNullFlag =false;// the flag for wasNull()
28-
28+
2929
// We can chain multiple resultSets together - this points to
3030
// next resultSet in the chain.
3131
protectedResultSetnext =null;
32-
32+
3333
/**
3434
* Create a new ResultSet - Note that we create ResultSets to
3535
* represent the results of everything.
@@ -52,8 +52,8 @@ public ResultSet(Connection conn, Field[] fields, Vector tuples, String status,
5252
this.this_row =null;
5353
this.current_row = -1;
5454
}
55-
56-
55+
56+
5757
/**
5858
* Create a new ResultSet - Note that we create ResultSets to
5959
* represent the results of everything.
@@ -69,7 +69,7 @@ public ResultSet(Connection conn, Field[] fields, Vector tuples, String status,
6969
{
7070
this(conn,fields,tuples,status,updateCount,0);
7171
}
72-
72+
7373
/**
7474
* We at times need to know if the resultSet we are working
7575
* with is the result of an UPDATE, DELETE or INSERT (in which
@@ -83,7 +83,7 @@ public boolean reallyResultSet()
8383
{
8484
return (fields !=null);
8585
}
86-
86+
8787
/**
8888
* Since ResultSets can be chained, we need some method of
8989
* finding the next one in the chain. The method getNext()
@@ -95,7 +95,7 @@ public java.sql.ResultSet getNext()
9595
{
9696
return (java.sql.ResultSet)next;
9797
}
98-
98+
9999
/**
100100
* This following method allows us to add a ResultSet object
101101
* to the end of the current chain.
@@ -109,7 +109,7 @@ public void append(ResultSet r)
109109
else
110110
next.append(r);
111111
}
112-
112+
113113
/**
114114
* If we are just a place holder for results, we still need
115115
* to get an updateCount. This method returns it.
@@ -120,7 +120,7 @@ public int getResultCount()
120120
{
121121
returnupdateCount;
122122
}
123-
123+
124124
/**
125125
* We also need to provide a couple of auxiliary functions for
126126
* the implementation of the ResultMetaData functions. In
@@ -133,7 +133,7 @@ public int getTupleCount()
133133
{
134134
returnrows.size();
135135
}
136-
136+
137137
/**
138138
* getColumnCount returns the number of columns
139139
*
@@ -143,7 +143,7 @@ public int getColumnCount()
143143
{
144144
returnfields.length;
145145
}
146-
146+
147147
/**
148148
* Returns the status message from the backend.<p>
149149
* It is used internally by the driver.
@@ -154,7 +154,7 @@ public String getStatusString()
154154
{
155155
returnstatus;
156156
}
157-
157+
158158
/**
159159
* returns the OID of a field.<p>
160160
* It is used internally by the driver.
@@ -166,20 +166,44 @@ public int getColumnOID(int field)
166166
{
167167
returnfields[field-1].getOID();
168168
}
169-
169+
170170
/**
171171
* returns the OID of the last inserted row
172172
*/
173173
publicintgetInsertedOID()
174174
{
175175
returninsertOID;
176176
}
177-
177+
178178
/**
179179
* This is part of the JDBC API, but is required by org.postgresql.Field
180180
*/
181181
publicabstractvoidclose()throwsSQLException;
182182
publicabstractbooleannext()throwsSQLException;
183183
publicabstractStringgetString(inti)throwsSQLException;
184+
185+
/**
186+
* This is used to fix get*() methods on Money fields. It should only be
187+
* used by those methods!
188+
*
189+
* It converts ($##.##) to -##.## and $##.## to ##.##
190+
*/
191+
publicStringgetFixedString(intcol)throwsSQLException {
192+
Strings =getString(col);
193+
194+
// Handle SQL Null
195+
if(s==null)
196+
returnnull;
197+
198+
// Handle Money
199+
if(s.charAt(0)=='(') {
200+
s="-"+org.postgresql.util.PGtokenizer.removePara(s).substring(1);
201+
}
202+
if(s.charAt(0)=='$') {
203+
s=s.substring(1);
204+
}
205+
206+
returns;
207+
}
184208
}
185209

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp