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

Commitd5d23dd

Browse files
committed
Allow jdbc to return proper server version number
Anders Bengtsson
1 parent9d5098c commitd5d23dd

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,19 @@ public String getDatabaseProductName() throws SQLException
167167
/**
168168
* What is the version of this database product.
169169
*
170-
* <p>Note that PostgreSQL 6.3 has a system catalog called pg_version -
171-
* however, select * from pg_version on any database retrieves
172-
* no rows.
173-
*
174-
* <p>For now, we will return the version 6.3 (in the hope that we change
175-
* this driver as often as we change the database)
176-
*
177170
* @return the database version
178171
* @exception SQLException if a database access error occurs
179172
*/
180173
publicStringgetDatabaseProductVersion()throwsSQLException
181174
{
182-
returnconnection.this_driver.getVersion();
175+
java.sql.ResultSetresultSet =connection.ExecSQL("select version()");
176+
resultSet.next();
177+
178+
StringTokenizerversionParts =newStringTokenizer(resultSet.getString(1));
179+
versionParts.nextToken();/* "PostgreSQL" */
180+
StringversionNumber =versionParts.nextToken();/* "X.Y.Z" */
181+
182+
returnversionNumber;
183183
}
184184

185185
/**

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,19 @@ public String getDatabaseProductName() throws SQLException
167167
/**
168168
* What is the version of this database product.
169169
*
170-
* <p>Note that PostgreSQL 6.3 has a system catalog called pg_version -
171-
* however, select * from pg_version on any database retrieves
172-
* no rows.
173-
*
174-
* <p>For now, we will return the version 6.3 (in the hope that we change
175-
* this driver as often as we change the database)
176-
*
177170
* @return the database version
178171
* @exception SQLException if a database access error occurs
179172
*/
180173
publicStringgetDatabaseProductVersion()throwsSQLException
181174
{
182-
returnconnection.this_driver.getVersion();
175+
java.sql.ResultSetresultSet =connection.ExecSQL("select version()");
176+
resultSet.next();
177+
178+
StringTokenizerversionParts =newStringTokenizer(resultSet.getString(1));
179+
versionParts.nextToken();/* "PostgreSQL" */
180+
StringversionNumber =versionParts.nextToken();/* "X.Y.Z" */
181+
182+
returnversionNumber;
183183
}
184184

185185
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp