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

Commit4f63a0e

Browse files
committed
Attached is a patch that fixes ResultSetMetaData.isNullable() in
the JDBC driver.This method is currently unimplemented and always returnsResultSetMetaData.columnNullable. This is obviously incorrectwhen a column is defined with NOT NULL or PRIMARY KEY. And wehave to think of check constraints, views, functions etc.The patch simply changes the return value toResultSetMetaData.columnNullableUnknown. This is until someonecomes up with a real implementation of course.On Fri, 14 Sep 2001 17:53:50 +0200, Tomisaw Kity?ski wrote:>Hello there,>>could someone tell me, please, do I have any chance to get>proper implementation of above method in JDBC (1.1+) soon?>>Current "return 1" works fine on most tables, however it seems>to be a little bit incorrect with some of them ;)Ren? Pijlman
1 parent6e63468 commit4f63a0e

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,22 @@ public boolean isCurrency(int column) throws SQLException
136136
}
137137

138138
/**
139-
* Can you put a NULL in this column? I think this is always
140-
* true in 6.1's case. It would only be false if the field had
141-
* been defined NOT NULL (system catalogs could be queried?)
139+
* Indicates the nullability of values in the designated column.
142140
*
143141
* @param column the first column is 1, the second is 2...
144142
* @return one of the columnNullable values
145143
* @exception SQLException if a database access error occurs
146144
*/
147145
publicintisNullable(intcolumn)throwsSQLException
148146
{
149-
returncolumnNullable;// We can always put NULL in
147+
/*
148+
* TODO This needs a real implementation, taking into account columns
149+
* defined with NOT NULL or PRIMARY KEY, CHECK constraints, views,
150+
* functions etc.
151+
*/
152+
returncolumnNullableUnknown;
150153
}
151-
154+
152155
/**
153156
* Is the column a signed number? In PostgreSQL, all numbers
154157
* are signed, so this is trivial. However, strings are not

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,20 @@ public boolean isCurrency(int column) throws SQLException
131131
}
132132

133133
/**
134-
* Can you put a NULL in this column? I think this is always
135-
* true in 6.1's case. It would only be false if the field had
136-
* been defined NOT NULL (system catalogs could be queried?)
134+
* Indicates the nullability of values in the designated column.
137135
*
138136
* @param column the first column is 1, the second is 2...
139137
* @return one of the columnNullable values
140138
* @exception SQLException if a database access error occurs
141139
*/
142140
publicintisNullable(intcolumn)throwsSQLException
143141
{
144-
returncolumnNullable;// We can always put NULL in
142+
/*
143+
* TODO This needs a real implementation, taking into account columns
144+
* defined with NOT NULL or PRIMARY KEY, CHECK constraints, views,
145+
* functions etc.
146+
*/
147+
returncolumnNullableUnknown;
145148
}
146149

147150
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp