mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-18 18:44:06 +08:00
Allow jdbc to return proper server version number
Anders Bengtsson
This commit is contained in:
parent
9d5098ca78
commit
d5d23dde25
@ -167,19 +167,19 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
/**
|
/**
|
||||||
* What is the version of this database product.
|
* What is the version of this database product.
|
||||||
*
|
*
|
||||||
* <p>Note that PostgreSQL 6.3 has a system catalog called pg_version -
|
|
||||||
* however, select * from pg_version on any database retrieves
|
|
||||||
* no rows.
|
|
||||||
*
|
|
||||||
* <p>For now, we will return the version 6.3 (in the hope that we change
|
|
||||||
* this driver as often as we change the database)
|
|
||||||
*
|
|
||||||
* @return the database version
|
* @return the database version
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public String getDatabaseProductVersion() throws SQLException
|
public String getDatabaseProductVersion() throws SQLException
|
||||||
{
|
{
|
||||||
return connection.this_driver.getVersion();
|
java.sql.ResultSet resultSet = connection.ExecSQL("select version()");
|
||||||
|
resultSet.next();
|
||||||
|
|
||||||
|
StringTokenizer versionParts = new StringTokenizer(resultSet.getString(1));
|
||||||
|
versionParts.nextToken(); /* "PostgreSQL" */
|
||||||
|
String versionNumber = versionParts.nextToken(); /* "X.Y.Z" */
|
||||||
|
|
||||||
|
return versionNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,19 +167,19 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
/**
|
/**
|
||||||
* What is the version of this database product.
|
* What is the version of this database product.
|
||||||
*
|
*
|
||||||
* <p>Note that PostgreSQL 6.3 has a system catalog called pg_version -
|
|
||||||
* however, select * from pg_version on any database retrieves
|
|
||||||
* no rows.
|
|
||||||
*
|
|
||||||
* <p>For now, we will return the version 6.3 (in the hope that we change
|
|
||||||
* this driver as often as we change the database)
|
|
||||||
*
|
|
||||||
* @return the database version
|
* @return the database version
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
*/
|
*/
|
||||||
public String getDatabaseProductVersion() throws SQLException
|
public String getDatabaseProductVersion() throws SQLException
|
||||||
{
|
{
|
||||||
return connection.this_driver.getVersion();
|
java.sql.ResultSet resultSet = connection.ExecSQL("select version()");
|
||||||
|
resultSet.next();
|
||||||
|
|
||||||
|
StringTokenizer versionParts = new StringTokenizer(resultSet.getString(1));
|
||||||
|
versionParts.nextToken(); /* "PostgreSQL" */
|
||||||
|
String versionNumber = versionParts.nextToken(); /* "X.Y.Z" */
|
||||||
|
|
||||||
|
return versionNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user