Wenjun Ruan
1 year ago
committed by
GitHub
45 changed files with 718 additions and 586 deletions
@ -0,0 +1,26 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* 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 org.apache.dolphinscheduler.dao.plugin.api.dialect; |
||||||
|
|
||||||
|
public interface DatabaseDialect { |
||||||
|
|
||||||
|
boolean tableExists(String tableName); |
||||||
|
|
||||||
|
boolean columnExists(String tableName, String columnName); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,33 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* 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 org.apache.dolphinscheduler.dao.plugin.h2.dialect; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.dao.plugin.api.dialect.DatabaseDialect; |
||||||
|
|
||||||
|
public class H2Dialect implements DatabaseDialect { |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean tableExists(String tableName) { |
||||||
|
throw new UnsupportedOperationException(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean columnExists(String tableName, String columnName) { |
||||||
|
throw new UnsupportedOperationException(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,61 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one |
||||||
|
* or more contributor license agreements. See the NOTICE file |
||||||
|
* distributed with this work for additional information |
||||||
|
* regarding copyright ownership. The ASF licenses this file |
||||||
|
* to you under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* 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 org.apache.dolphinscheduler.dao.plugin.mysql.dialect; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.dao.plugin.api.dialect.DatabaseDialect; |
||||||
|
|
||||||
|
import java.sql.Connection; |
||||||
|
import java.sql.ResultSet; |
||||||
|
|
||||||
|
import javax.sql.DataSource; |
||||||
|
|
||||||
|
import lombok.SneakyThrows; |
||||||
|
|
||||||
|
public class MysqlDialect implements DatabaseDialect { |
||||||
|
|
||||||
|
private final DataSource dataSource; |
||||||
|
|
||||||
|
public MysqlDialect(DataSource dataSource) { |
||||||
|
this.dataSource = dataSource; |
||||||
|
} |
||||||
|
|
||||||
|
@SneakyThrows |
||||||
|
@Override |
||||||
|
public boolean tableExists(String tableName) { |
||||||
|
try ( |
||||||
|
Connection conn = dataSource.getConnection(); |
||||||
|
ResultSet rs = conn.getMetaData().getTables(conn.getCatalog(), conn.getSchema(), tableName, null)) { |
||||||
|
return rs.next(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@SneakyThrows |
||||||
|
@Override |
||||||
|
public boolean columnExists(String tableName, String columnName) { |
||||||
|
try ( |
||||||
|
Connection conn = dataSource.getConnection(); |
||||||
|
ResultSet rs = |
||||||
|
conn.getMetaData().getColumns(conn.getCatalog(), conn.getSchema(), tableName, columnName)) { |
||||||
|
return rs.next(); |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,111 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* 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 org.apache.dolphinscheduler.dao.datasource; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.dao.plugin.api.DaoPluginConfiguration; |
|
||||||
import org.apache.dolphinscheduler.dao.plugin.api.monitor.DatabaseMonitor; |
|
||||||
|
|
||||||
import org.apache.ibatis.session.SqlSessionFactory; |
|
||||||
import org.apache.ibatis.type.JdbcType; |
|
||||||
|
|
||||||
import javax.sql.DataSource; |
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer; |
|
||||||
import org.springframework.context.annotation.Bean; |
|
||||||
import org.springframework.context.annotation.Configuration; |
|
||||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; |
|
||||||
import org.springframework.core.io.support.ResourcePatternResolver; |
|
||||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.DbType; |
|
||||||
import com.baomidou.mybatisplus.annotation.IdType; |
|
||||||
import com.baomidou.mybatisplus.core.MybatisConfiguration; |
|
||||||
import com.baomidou.mybatisplus.core.config.GlobalConfig; |
|
||||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
|
||||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; |
|
||||||
|
|
||||||
@Configuration |
|
||||||
public class SpringConnectionFactory { |
|
||||||
|
|
||||||
/** |
|
||||||
* Inject this field to make sure the database is initialized, this can solve the table not found issue #8432. |
|
||||||
*/ |
|
||||||
@Autowired(required = false) |
|
||||||
public DataSourceScriptDatabaseInitializer dataSourceScriptDatabaseInitializer; |
|
||||||
|
|
||||||
/** |
|
||||||
* Inject this field to make sure the DaoPluginConfiguration is initialized before SpringConnectionFactory. |
|
||||||
*/ |
|
||||||
@Autowired |
|
||||||
public DaoPluginConfiguration daoPluginConfiguration; |
|
||||||
|
|
||||||
@Bean |
|
||||||
public MybatisPlusInterceptor paginationInterceptor(DbType dbType) { |
|
||||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
|
||||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(dbType)); |
|
||||||
return interceptor; |
|
||||||
} |
|
||||||
|
|
||||||
@Bean |
|
||||||
public DataSourceTransactionManager transactionManager(DataSource dataSource) { |
|
||||||
return new DataSourceTransactionManager(dataSource); |
|
||||||
} |
|
||||||
|
|
||||||
@Bean |
|
||||||
public SqlSessionFactory sqlSessionFactory(DataSource dataSource, |
|
||||||
GlobalConfig globalConfig, |
|
||||||
DbType dbType) throws Exception { |
|
||||||
MybatisConfiguration configuration = new MybatisConfiguration(); |
|
||||||
configuration.setMapUnderscoreToCamelCase(true); |
|
||||||
configuration.setCacheEnabled(false); |
|
||||||
configuration.setCallSettersOnNulls(true); |
|
||||||
configuration.setJdbcTypeForNull(JdbcType.NULL); |
|
||||||
configuration.addInterceptor(paginationInterceptor(dbType)); |
|
||||||
|
|
||||||
MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean(); |
|
||||||
sqlSessionFactoryBean.setConfiguration(configuration); |
|
||||||
sqlSessionFactoryBean.setDataSource(dataSource); |
|
||||||
|
|
||||||
sqlSessionFactoryBean.setGlobalConfig(globalConfig); |
|
||||||
sqlSessionFactoryBean.setTypeAliasesPackage("org.apache.dolphinscheduler.dao.entity"); |
|
||||||
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); |
|
||||||
// todo: if the different database has different sql, we need to add the different mapper.
|
|
||||||
sqlSessionFactoryBean |
|
||||||
.setMapperLocations(resolver.getResources("org/apache/dolphinscheduler/dao/mapper/*Mapper.xml")); |
|
||||||
return sqlSessionFactoryBean.getObject(); |
|
||||||
} |
|
||||||
|
|
||||||
@Bean |
|
||||||
public GlobalConfig globalConfig() { |
|
||||||
return new GlobalConfig().setDbConfig(new GlobalConfig.DbConfig() |
|
||||||
.setIdType(IdType.AUTO)).setBanner(false); |
|
||||||
} |
|
||||||
|
|
||||||
@Bean |
|
||||||
public DbType dbType() { |
|
||||||
return daoPluginConfiguration.dbType(); |
|
||||||
} |
|
||||||
|
|
||||||
@Bean |
|
||||||
public DatabaseMonitor databaseMonitor() { |
|
||||||
return daoPluginConfiguration.databaseMonitor(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,60 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* 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 org.apache.dolphinscheduler.dao.upgrade; |
|
||||||
|
|
||||||
import java.util.HashMap; |
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
import javax.sql.DataSource; |
|
||||||
|
|
||||||
import org.junit.jupiter.api.Assertions; |
|
||||||
import org.junit.jupiter.api.Test; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.test.context.ActiveProfiles; |
|
||||||
|
|
||||||
@ActiveProfiles("h2") |
|
||||||
public class ProcessDefinitionDaoTest { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private DataSource dataSource; |
|
||||||
final ProcessDefinitionDao processDefinitionDao = new ProcessDefinitionDao(); |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testQueryAllProcessDefinition() { |
|
||||||
// Map<Integer, String> processDefinitionJsonMap =
|
|
||||||
// processDefinitionDao.queryAllProcessDefinition(dataSource.getConnection());
|
|
||||||
// assertThat(processDefinitionJsonMap.size(),greaterThanOrEqualTo(0));
|
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testUpdateProcessDefinitionJson() { |
|
||||||
Map<Integer, String> processDefinitionJsonMap = new HashMap<>(); |
|
||||||
processDefinitionJsonMap.put(1, "test"); |
|
||||||
// processDefinitionDao.updateProcessDefinitionJson(dataSource.getConnection(),processDefinitionJsonMap);
|
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testQueryAllProcessDefinitionException() { |
|
||||||
// processDefinitionDao.queryAllProcessDefinition(null);
|
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testUpdateProcessDefinitionJsonException() { |
|
||||||
Assertions.assertThrows(Exception.class, () -> processDefinitionDao.updateProcessDefinitionJson(null, null)); |
|
||||||
} |
|
||||||
} |
|
@ -1,50 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* 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 org.apache.dolphinscheduler.dao.upgrade; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.dao.DaoConfiguration; |
|
||||||
|
|
||||||
import javax.sql.DataSource; |
|
||||||
|
|
||||||
import org.junit.jupiter.api.Assertions; |
|
||||||
import org.junit.jupiter.api.Test; |
|
||||||
import org.junit.jupiter.api.extension.ExtendWith; |
|
||||||
import org.mockito.junit.jupiter.MockitoExtension; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|
||||||
import org.springframework.boot.test.context.SpringBootTest; |
|
||||||
import org.springframework.test.context.ActiveProfiles; |
|
||||||
|
|
||||||
@ActiveProfiles("h2") |
|
||||||
@SpringBootTest(classes = DaoConfiguration.class) |
|
||||||
@ExtendWith(MockitoExtension.class) |
|
||||||
@SpringBootApplication(scanBasePackageClasses = DaoConfiguration.class) |
|
||||||
public class WorkerGroupDaoTest { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
protected DataSource dataSource; |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testQueryQueryAllOldWorkerGroupException() throws Exception { |
|
||||||
Assertions.assertThrows(Exception.class, () -> { |
|
||||||
WorkerGroupDao workerGroupDao = new WorkerGroupDao(); |
|
||||||
workerGroupDao.queryAllOldWorkerGroup(null); |
|
||||||
}); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,56 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* 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 org.apache.dolphinscheduler.tools.datasource; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.dao.DaoConfiguration; |
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
|
|
||||||
import org.springframework.boot.CommandLineRunner; |
|
||||||
import org.springframework.boot.SpringApplication; |
|
||||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration; |
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|
||||||
import org.springframework.context.annotation.Profile; |
|
||||||
import org.springframework.stereotype.Component; |
|
||||||
|
|
||||||
@ImportAutoConfiguration(DaoConfiguration.class) |
|
||||||
@SpringBootApplication |
|
||||||
public class InitDolphinScheduler { |
|
||||||
|
|
||||||
public static void main(String[] args) { |
|
||||||
SpringApplication.run(InitDolphinScheduler.class, args); |
|
||||||
} |
|
||||||
|
|
||||||
@Component |
|
||||||
@Profile("init") |
|
||||||
@Slf4j |
|
||||||
static class InitRunner implements CommandLineRunner { |
|
||||||
|
|
||||||
private final DolphinSchedulerManager dolphinSchedulerManager; |
|
||||||
|
|
||||||
InitRunner(DolphinSchedulerManager dolphinSchedulerManager) { |
|
||||||
this.dolphinSchedulerManager = dolphinSchedulerManager; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void run(String... args) { |
|
||||||
dolphinSchedulerManager.initDolphinScheduler(); |
|
||||||
log.info("init DolphinScheduler finished"); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,90 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* 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 org.apache.dolphinscheduler.tools.datasource.dao; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.spi.enums.DbType; |
|
||||||
|
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.ResultSet; |
|
||||||
import java.sql.SQLException; |
|
||||||
|
|
||||||
import javax.sql.DataSource; |
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
|
|
||||||
import org.springframework.context.annotation.Profile; |
|
||||||
import org.springframework.stereotype.Service; |
|
||||||
|
|
||||||
@Service |
|
||||||
@Slf4j |
|
||||||
@Profile("mysql") |
|
||||||
public class MySQLUpgradeDao extends UpgradeDao { |
|
||||||
|
|
||||||
private MySQLUpgradeDao(DataSource dataSource) { |
|
||||||
super(dataSource); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String initSqlPath() { |
|
||||||
return "create/release-1.0.0_schema/mysql"; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public DbType getDbType() { |
|
||||||
return DbType.MYSQL; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* determines whether a table exists |
|
||||||
* @param tableName tableName |
|
||||||
* @return if table exist return true,else return false |
|
||||||
*/ |
|
||||||
@Override |
|
||||||
public boolean isExistsTable(String tableName) { |
|
||||||
try ( |
|
||||||
Connection conn = dataSource.getConnection(); |
|
||||||
ResultSet rs = conn.getMetaData().getTables(conn.getCatalog(), conn.getSchema(), tableName, null)) { |
|
||||||
return rs.next(); |
|
||||||
} catch (SQLException e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException(e.getMessage(), e); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* determines whether a field exists in the specified table |
|
||||||
* @param tableName tableName |
|
||||||
* @param columnName columnName |
|
||||||
* @return if column name exist return true,else return false |
|
||||||
*/ |
|
||||||
@Override |
|
||||||
public boolean isExistsColumn(String tableName, String columnName) { |
|
||||||
try ( |
|
||||||
Connection conn = dataSource.getConnection(); |
|
||||||
ResultSet rs = |
|
||||||
conn.getMetaData().getColumns(conn.getCatalog(), conn.getSchema(), tableName, columnName)) { |
|
||||||
return rs.next(); |
|
||||||
|
|
||||||
} catch (SQLException e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException(e.getMessage(), e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,16 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 |
||||||
|
* |
||||||
|
* 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. |
||||||
|
*/ |
@ -0,0 +1,16 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 |
||||||
|
* |
||||||
|
* 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. |
||||||
|
*/ |
@ -0,0 +1,16 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 |
||||||
|
* |
||||||
|
* 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. |
||||||
|
*/ |
@ -0,0 +1,16 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 |
||||||
|
* |
||||||
|
* 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. |
||||||
|
*/ |
@ -0,0 +1,16 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 |
||||||
|
* |
||||||
|
* 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. |
||||||
|
*/ |
@ -0,0 +1,16 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 |
||||||
|
* |
||||||
|
* 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. |
||||||
|
*/ |
Loading…
Reference in new issue