File tree Expand file tree Collapse file tree 2 files changed +16
-16
lines changed
src/interfaces/jdbc/org/postgresql Expand file tree Collapse file tree 2 files changed +16
-16
lines changed Original file line number Diff line number Diff 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 public String getDatabaseProductVersion () throws SQLException
181174 {
182- return connection .this_driver .getVersion ();
175+ java .sql .ResultSet resultSet = connection .ExecSQL ("select version()" );
176+ resultSet .next ();
177+
178+ StringTokenizer versionParts = new StringTokenizer (resultSet .getString (1 ));
179+ versionParts .nextToken (); /* "PostgreSQL" */
180+ String versionNumber = versionParts .nextToken (); /* "X.Y.Z" */
181+
182+ return versionNumber ;
183183 }
184184
185185 /**
Original file line number Diff line number Diff 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 public String getDatabaseProductVersion () throws SQLException
181174 {
182- return connection .this_driver .getVersion ();
175+ java .sql .ResultSet resultSet = connection .ExecSQL ("select version()" );
176+ resultSet .next ();
177+
178+ StringTokenizer versionParts = new StringTokenizer (resultSet .getString (1 ));
179+ versionParts .nextToken (); /* "PostgreSQL" */
180+ String versionNumber = versionParts .nextToken (); /* "X.Y.Z" */
181+
182+ return versionNumber ;
183183 }
184184
185185 /**
You can’t perform that action at this time.
0 commit comments