Skip to content

Commit

Permalink
Merge branch 'master' of github.com:hs-web/hsweb-easy-orm
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou-hao committed Nov 20, 2023
2 parents e822987 + 49d4f4e commit 383d1bf
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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\"",
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 383d1bf

Please sign in to comment.