diff --git a/hsweb-easy-orm-rdb/src/main/java/org/hswebframework/ezorm/rdb/supports/oracle/OracleTableMetadataParser.java b/hsweb-easy-orm-rdb/src/main/java/org/hswebframework/ezorm/rdb/supports/oracle/OracleTableMetadataParser.java index c92a8a98..ed5ee840 100644 --- a/hsweb-easy-orm-rdb/src/main/java/org/hswebframework/ezorm/rdb/supports/oracle/OracleTableMetadataParser.java +++ b/hsweb-easy-orm-rdb/src/main/java/org/hswebframework/ezorm/rdb/supports/oracle/OracleTableMetadataParser.java @@ -9,7 +9,8 @@ import java.util.List; public class OracleTableMetadataParser extends RDBTableMetadataParser { - private final static String TABLE_META_SQL = String.join(" ", + private final static String TABLE_META_SQL = String.join( + " ", "select distinct(cols.column_name) as \"name\"", ",cols.table_name as \"table_name\"", ",cols.data_type as \"data_type\"", @@ -19,21 +20,35 @@ public class OracleTableMetadataParser extends RDBTableMetadataParser { ",acc.comments as \"comment\"", ",case when cols.nullable='Y' then 0 else 1 end as \"not_null\"", ",cols.table_name as \"table_name\"", - ",cols.column_id from all_tab_cols cols ", - "left join all_col_comments acc on acc.OWNER = #{schema} and acc.column_name=cols.column_name and acc.table_name=cols.table_name ", - "where cols.owner=#{schema} and cols.table_name like upper(#{table}) and (cols.virtual_column='NO' or cols.virtual_column is null) ", + ",cols.column_id from all_tab_cols cols", + "left join all_col_comments acc on acc.OWNER = #{schema} and acc.column_name=cols.column_name and acc.table_name=cols.table_name", + "where cols.owner=#{schema} and cols.table_name like upper(#{table})", + "and cols.table_name not like '%$%'", + "and cols.table_name not like 'LOGMNR%'", + "and cols.table_name not in ('HELP', 'SQLPLUS_PRODUCT_PROFILE')", + "and (cols.virtual_column='NO' or cols.virtual_column is null) ", "order by cols.column_id "); - private final static String TABLE_COMMENT_SQL = String.join(" ", + private final static String TABLE_COMMENT_SQL = String.join( + " ", "select", "table_name as \"table_name\",", "comments as \"comment\"", "from all_tab_comments ", "where owner=#{schema} and table_type='TABLE' and table_name like upper(#{table})"); - private final static String ALL_TABLE_SQL = "select table_name as \"name\" from all_tab_comments where owner=#{schema} and table_type='TABLE'"; - - private static final String TABLE_EXISTS_SQL = "select count(1) as \"total\" from all_tab_comments where owner=#{schema} and table_type='TABLE' and table_name=upper(#{table})"; + private final static String ALL_TABLE_SQL = String.join( + " ", + "select table_name as \"name\" from all_tab_comments ", + "where owner=#{schema} ", + "and table_name not like '%$%'", + "and table_name not like 'LOGMNR%'", + "and table_name not in ('HELP', 'SQLPLUS_PRODUCT_PROFILE')", + "and table_type='TABLE'"); + private static final String TABLE_EXISTS_SQL = "select count(1) as \"total\" from all_tab_comments " + + "where owner=#{schema} " + + "and table_type='TABLE' " + + "and table_name=upper(#{table})"; public OracleTableMetadataParser(RDBSchemaMetadata schema) { super(schema); diff --git a/hsweb-easy-orm-rdb/src/test/java/org/hswebframework/ezorm/rdb/supports/oracle/OracleTableMetaParserTest.java b/hsweb-easy-orm-rdb/src/test/java/org/hswebframework/ezorm/rdb/supports/oracle/OracleTableMetaParserTest.java index 190b5f56..18230fdb 100644 --- a/hsweb-easy-orm-rdb/src/test/java/org/hswebframework/ezorm/rdb/supports/oracle/OracleTableMetaParserTest.java +++ b/hsweb-easy-orm-rdb/src/test/java/org/hswebframework/ezorm/rdb/supports/oracle/OracleTableMetaParserTest.java @@ -1,8 +1,6 @@ package org.hswebframework.ezorm.rdb.supports.oracle; -import io.r2dbc.spi.Statement; import org.hswebframework.ezorm.rdb.TestJdbcReactiveSqlExecutor; -import org.hswebframework.ezorm.rdb.TestReactiveSqlExecutor; import org.hswebframework.ezorm.rdb.TestSyncSqlExecutor; import org.hswebframework.ezorm.rdb.executor.SqlRequests; import org.hswebframework.ezorm.rdb.executor.SyncSqlExecutor; @@ -11,7 +9,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import reactor.test.StepVerifier; import java.math.BigDecimal; import java.sql.JDBCType; @@ -38,12 +35,22 @@ public void init() { @Test public void testParseReactive() { - schema.loadAllTableReactive() - .as(StepVerifier::create) - .expectComplete() - .verify(); - - System.out.println(1); +// schema.loadAllTableReactive() +// .as(StepVerifier::create) +// .expectComplete() +// .verify(); + + + parser.parseAllTableNameReactive() + .doOnNext(System.out::println) + .blockLast(); + +// parser.parseAllReactive() +// .doOnNext(table -> System.out.println(table.getName())) +// .then() +// .as(StepVerifier::create) +// .expectComplete() +// .verify(); } @Test