提交 92ac8137 编写于 作者: S Serge Rider

JDBC factory - postgre

上级 1cf7c107
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.ext.postgresql.model.jdbc;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSetMetaData;
import org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCFactoryDefault;
import java.sql.SQLException;
/**
* PostgreTypeType
*/
public class PostgreJdbcFactory extends JDBCFactoryDefault
{
@Override
public JDBCResultSetMetaData createResultSetMetaData(@NotNull JDBCResultSet resultSet) throws SQLException {
return new PostgreResultSetMetaDataImpl(resultSet);
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.ext.postgresql.model.jdbc;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCResultSetMetaDataImpl;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
/**
* JDBCResultSetMetaDataImpl
*/
public class PostgreResultSetMetaDataImpl extends JDBCResultSetMetaDataImpl
{
public PostgreResultSetMetaDataImpl(JDBCResultSet resultSet) throws SQLException {
super(resultSet);
}
@Override
public String getSchemaName(int column) throws SQLException {
String schemaName;
try {
schemaName = (String)original.getClass().getMethod("getBaseSchemaName", Integer.TYPE).invoke(column);
} catch (InvocationTargetException e) {
throw new SQLException("Error getting schema name", e.getTargetException());
} catch (Exception e) {
throw new SQLException("Error getting schema name", e);
}
return JDBCUtils.normalizeIdentifier(schemaName);
}
}
......@@ -20,7 +20,6 @@ package org.jkiss.dbeaver.model.impl.jdbc.exec;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.DBCAttributeMetaData;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSetMetaData;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
......@@ -38,10 +37,10 @@ import java.util.Map;
*/
public class JDBCResultSetMetaDataImpl implements JDBCResultSetMetaData
{
private JDBCResultSet resultSet;
private ResultSetMetaData original;
private List<DBCAttributeMetaData> columns = new ArrayList<>();
private Map<String, JDBCTableMetaData> tables = new HashMap<>();
protected JDBCResultSet resultSet;
protected ResultSetMetaData original;
protected List<DBCAttributeMetaData> columns = new ArrayList<>();
protected Map<String, JDBCTableMetaData> tables = new HashMap<>();
public JDBCResultSetMetaDataImpl(JDBCResultSet resultSet)
throws SQLException
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册