Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2019 the original author or authors.
*
* Licensed under the LGPL, Version 3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.gnu.org/licenses/lgpl-3.0.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jn.sqlhelper.common.ddl.dump;
import com.jn.langx.util.Emptys;
import com.jn.langx.util.collection.Collects;
import com.jn.langx.util.function.Consumer;
import com.jn.langx.util.io.IOs;
import com.jn.sqlhelper.common.ddl.model.*;
import com.jn.sqlhelper.common.ddl.model.internal.TableType;
import com.jn.sqlhelper.common.resultset.BeanRowMapper;
import com.jn.sqlhelper.common.resultset.RowMapperResultSetExtractor;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
public class DatabaseLoader {
private static final String[] tableTypes = new String[]{
TableType.GLOBAL_TEMPORARY.getCode(),
TableType.LOCAL_TEMPORARY.getCode(),
TableType.TABLE.getCode()
};
public Table loadTable(DatabaseDescription databaseDescription, String catalog, String schema, String tableName) throws SQLException {
return loadTable(databaseDescription, catalog, schema, tableName, false, false, false, false);
}
public Table loadTable(DatabaseDescription databaseDescription, String catalog, String schema, String tableName, boolean isLoadColumns, boolean isLoadPks, boolean isLoadIndexes, boolean isLoadFks) throws SQLException {
List
tables = loadTables(databaseDescription, catalog, schema, tableName, isLoadColumns, isLoadPks, isLoadIndexes, isLoadFks);
if (Emptys.isNotEmpty(tables)) {
return tables.get(0);
}
return null;
}
public List