Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SQLLINE-183] Add wrapper (via reflection way) for DatabaseMetaData t… #196

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/docbkx/manual.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3026,6 +3026,16 @@ java.sql.SQLException: ORA-00942: table or view does not exist
<literal>true</literal>.
</para>
</sect1>
<sect1 id="setting_silent">
<title>silent</title>
<para>
If <literal>false</literal>, then use default values
defined by <literal>java.sql.DatabaseMetaData</literal>
in case an implementation of this interface fails with
e.g. "Method not supported", otherwise it also fails.
Defaults to <literal>false</literal>.
</para>
</sect1>
<sect1 id="setting_silent">
<title>silent</title>
<para>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/sqlline/BuiltInProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public enum BuiltInProperty implements SqlLineProperty {
SHOW_HEADER("showHeader", Type.BOOLEAN, true),
SHOW_NESTED_ERRS("showNestedErrs", Type.BOOLEAN, false),
SHOW_WARNINGS("showWarnings", Type.BOOLEAN, true),
STRICT_JDBC("strictJdbc", Type.BOOLEAN, false),
TIME_FORMAT("timeFormat", Type.STRING, DEFAULT),
TIMEOUT("timeout", Type.INTEGER, -1),
TIMESTAMP_FORMAT("timestampFormat", Type.STRING, DEFAULT),
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/sqlline/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,10 @@ public void metadata(
}

Object res = sqlLine.getReflector().invoke(sqlLine.getDatabaseMetaData(),
DatabaseMetaData.class, cmd, argList);
DatabaseMetaDataWrapper.class, cmd, argList);
if (res instanceof ResultSet) {
ResultSet rs = (ResultSet) res;
try {
try (ResultSet rs = (ResultSet) res) {
sqlLine.print(rs, callback);
} finally {
rs.close();
}
} else if (res != null) {
sqlLine.output(res.toString());
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/sqlline/DatabaseConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class DatabaseConnection {
private final SqlLine sqlLine;
Connection connection;
DatabaseMetaData meta;
DatabaseMetaDataWrapper meta;
private final String driver;
private final String url;
private final Properties info;
Expand Down Expand Up @@ -128,7 +128,7 @@ boolean connect() throws SQLException {
// Instead, we use the driver instance to make the connection

connection = theDriver.connect(url, info);
meta = connection.getMetaData();
meta = new DatabaseMetaDataWrapper(sqlLine, connection.getMetaData());

try {
sqlLine.debug(
Expand Down Expand Up @@ -219,7 +219,7 @@ Schema getSchema() {
return schema;
}

DatabaseMetaData getDatabaseMetaData() {
DatabaseMetaDataWrapper getDatabaseMetaData() {
return meta;
}

Expand Down
Loading