• R/O
  • HTTP
  • SSH
  • HTTPS

rapideact: Commit


Commit MetaInfo

Revision6e683d62093f41e6f4dbc9d9ed9dc1feab09e110 (tree)
Time2017-07-30 19:55:50
Authorkuboryu <kuboryu@yaho...>
Commiterkuboryu

Log Message

20170730

Change Summary

Incremental Difference

--- a/com/rapide_act/CmnAccessObjects.java
+++ b/com/rapide_act/CmnAccessObjects.java
@@ -407,7 +407,7 @@ public class CmnAccessObjects{
407407 colBoolean = null;
408408 ByteArrayOutputStream baos = null;
409409 InputStream is = null;
410-
410+ CmnUtils.deepPrint("colType=" + _colTypeName);
411411 if (CmnUtils.isColString(_colTypeName)) {
412412 colString = _rst.getString(_rec_cnt);
413413 if (colString != null) {
--- a/com/rapide_act/CmnProps.java
+++ b/com/rapide_act/CmnProps.java
@@ -73,7 +73,7 @@ public class CmnProps{
7373 ":r ",
7474 "source ",
7575 "",
76- "",
76+ "\\i ",
7777 ""
7878 };
7979 protected static final String [] SQL_COMMENT_MARK = {
@@ -675,9 +675,9 @@ public class CmnProps{
675675 + " a.table_name,"
676676 + " replace(replace(a.table_comment, char(13), ''), char(10), '') as table_comments, "
677677 + " b.column_name,"
678- + " replace(replace(b.column_comment, char(13), ''), char(10), '') as column_comment, "
679- + " b.column_type,"
680- + " b.character_maximum_length as data_precision,"
678+ + " replace(replace(b.column_comment, char(13), ''), char(10), '') as column_comments, "
679+ + " b.column_type as data_type,"
680+ + " b.character_maximum_length as data_length,"
681681 + " b.numeric_precision as data_precision,"
682682 + " b.numeric_scale as data_scale,"
683683 + " case b.is_nullable"
@@ -794,7 +794,7 @@ public class CmnProps{
794794 + " replace(replace(a.remarks, chr(13), ''), chr(10), '') as table_comments, "
795795 + " b.colname,"
796796 + " replace(replace(b.remarks, chr(13), ''), chr(10), '') as column_comments, "
797- + " b.typename,"
797+ + " b.typename as data_type,"
798798 + " b.length as data_length, "
799799 + " b.length as data_precision, "
800800 + " b.scale as data_scale, "
@@ -911,6 +911,174 @@ public class CmnProps{
911911 + " and b.colseq = c.colseq"
912912 + " order by"
913913 + " a.tabname,a.constname,b.colseq,c.colseq"
914+ },
915+ { //PostgreSQL
916+ "select "
917+ + " a.table_name,"
918+ + " e.description as table_comments,"
919+ + " b.column_name,"
920+ + " f.description as column_comments,"
921+ + " data_type,"
922+ + " b.character_maximum_length as data_length,"
923+ + " b.numeric_precision as data_precision,"
924+ + " b.numeric_scale as data_scale,"
925+ + " case b.is_nullable"
926+ + " when 'NO' then '〇'"
927+ + " else null "
928+ + " end as nullable,"
929+ + " b.column_default as data_default "
930+ + " from "
931+ + " information_schema.tables a,"
932+ + " information_schema.columns b,"
933+ + " pg_stat_user_tables c"
934+ + " left outer join pg_description e"
935+ + " on c.relid=e.objoid and e.objsubid=0,"
936+ + " pg_attribute d"
937+ + " left outer join pg_description f"
938+ + " on f.objoid=d.attrelid and f.objsubid=d.attnum"
939+ + " where "
940+ + " a.table_schema = current_schema()"
941+ + " and a.table_type = 'BASE TABLE'"
942+ + " and a.table_schema = b.table_schema "
943+ + " and a.table_name = b.table_name "
944+ + " and a.table_schema = c.schemaname "
945+ + " and a.table_name = c.relname"
946+ + " and c.relid = d.attrelid"
947+ + " and b.column_name = d.attname"
948+ + " order by a.table_name,b.ordinal_position",
949+ "select "
950+ + " a.table_name, "
951+ + " b.constraint_name as index_name,"
952+ + " ''::text as index_type, "
953+ + " case b.constraint_type "
954+ + " when 'PRIMARY KEY' then 'P' "
955+ + " when 'UNIQUE' then 'U' "
956+ + " end as constraint_type,"
957+ + " c.column_name,"
958+ + " c.ordinal_position as column_position"
959+ + " from"
960+ + " information_schema.tables a,"
961+ + " information_schema.table_constraints b,"
962+ + " information_schema.key_column_usage c"
963+ + " where"
964+ + " a.table_schema = current_schema()"
965+ + " and a.table_type = 'BASE TABLE'"
966+ + " and a.table_schema = b.table_schema"
967+ + " and a.table_name = b.table_name"
968+ + " and b.table_schema = c.table_schema"
969+ + " and b.table_name = c.table_name"
970+ + " and b.constraint_name = c.constraint_name"
971+ + " and b.constraint_type in('PRIMARY KEY','UNIQUE')"
972+ + " union select"
973+ + " e.tablename::text as table_name,"
974+ + " e.indexname::text as index_name,"
975+ + " ''::text as index_type,"
976+ + " ''::text as constraint_type,"
977+ + " f.column_name,"
978+ + " e.column_position"
979+ + " from"
980+ + " ("
981+ + " select"
982+ + " d.schemaname,"
983+ + " d.tablename,"
984+ + " d.indexname,"
985+ + " d.indkey,"
986+ + " row_number() over() as column_position"
987+ + " from"
988+ + " ("
989+ + " select"
990+ + " a.schemaname,"
991+ + " a.tablename,"
992+ + " a.indexname,"
993+ + " unnest(string_to_array(c.indkey::text, ' '))::int indkey"
994+ + " from"
995+ + " pg_indexes a,"
996+ + " pg_stat_user_indexes b,"
997+ + " pg_index c"
998+ + " where"
999+ + " a.schemaname = current_schema()"
1000+ + " and a.schemaname = b.schemaname"
1001+ + " and a.tablename = b.relname"
1002+ + " and a.indexname = b.indexrelname"
1003+ + " and b.relid = c.indrelid"
1004+ + " and b.indexrelid = c.indexrelid"
1005+ + " and c.indisunique = false"
1006+ + " and c.indisprimary = false"
1007+ + " ) d"
1008+ + " ) e,"
1009+ + " information_schema.columns f"
1010+ + " where "
1011+ + " e.schemaname = current_schema()"
1012+ + " and e.schemaname = f.table_schema"
1013+ + " and e.tablename = f.table_name"
1014+ + " and e.indkey = f.ordinal_position"
1015+ + " order by table_name,index_name,column_position",
1016+ "select "
1017+ + " a.table_name as view_name, "
1018+ + " ''::text as comments "
1019+ + "from "
1020+ + " information_schema.views a "
1021+ + " where"
1022+ + " table_schema = current_schema()"
1023+ + " order by "
1024+ + " a.table_name",
1025+ "select "
1026+ + " routine_name as object_name, "
1027+ + " routine_type as object_type, "
1028+ + " '' as action_timing, "
1029+ + " '' as event_action, "
1030+ + " '' as event_object "
1031+ + " from "
1032+ + " information_schema.routines "
1033+ + " where"
1034+ + " routine_schema = current_schema()"
1035+ + " and (routine_type = 'PROCEDURE' or routine_type = 'FUNCTION') "
1036+ + " union select "
1037+ + " trigger_name as object_name, "
1038+ + " 'TRIGGER' as object_type, "
1039+ + " action_timing as action_timing, "
1040+ + " event_manipulation as event_action, "
1041+ + " event_object_table as event_object "
1042+ + " from "
1043+ + " information_schema.triggers "
1044+ + " where"
1045+ + " trigger_schema = current_schema()"
1046+ + " order by object_name,object_type ",
1047+ "",
1048+ "",
1049+ "",
1050+ "select "
1051+ + " a.table_name,"
1052+ + " a.constraint_name,"
1053+ + " c.column_name,"
1054+ + " d.table_name as r_table_name,"
1055+ + " e.column_name as r_column_name,"
1056+ + " f.ordinal_position as position,"
1057+ + " g.ordinal_position as r_position"
1058+ + " from"
1059+ + " information_schema.table_constraints a,"
1060+ + " information_schema.referential_constraints b,"
1061+ + " information_schema.constraint_column_usage c,"
1062+ + " information_schema.table_constraints d,"
1063+ + " information_schema.constraint_column_usage e,"
1064+ + " information_schema.columns f,"
1065+ + " information_schema.columns g"
1066+ + " where "
1067+ + " a.constraint_schema = current_schema()"
1068+ + " and a.constraint_schema = b.constraint_schema"
1069+ + " and a.constraint_schema = c.constraint_schema"
1070+ + " and a.constraint_name = b.constraint_name"
1071+ + " and a.constraint_name = c.constraint_name"
1072+ + " and a.constraint_type = 'FOREIGN KEY'"
1073+ + " and b.constraint_schema = d.constraint_schema"
1074+ + " and b.unique_constraint_name = d.constraint_name"
1075+ + " and d.constraint_schema = e.constraint_schema"
1076+ + " and d.constraint_name = e.constraint_name"
1077+ + " and a.table_schema = f.table_schema"
1078+ + " and c.table_name = f.table_name"
1079+ + " and c.column_name = f.column_name"
1080+ + " and e.table_name = g.table_name"
1081+ + " and e.column_name = g.column_name"
9141082 }
9151083 };
9161084 protected static String sql_view_text[] = {
@@ -923,7 +1091,8 @@ public class CmnProps{
9231091 + "on c.object_id = b.object_id "
9241092 + "where a.name = ?",
9251093 "select view_definition from information_schema.views where table_name = ?",
926- "select text from syscat.views where viewname= ?"
1094+ "select text from syscat.views where viewname= ?",
1095+ "select view_definition from information_schema.views where table_name = ?"
9271096 };
9281097 protected static String sql_view_column_and_comment[] = {
9291098 "select "
@@ -964,7 +1133,15 @@ public class CmnProps{
9641133 + " where"
9651134 + " tabschema = current_schema"
9661135 + " and tabname = ?"
967- + " order by colno"
1136+ + " order by colno",
1137+ " select "
1138+ + " column_name,"
1139+ + " ''::text as column_comment "
1140+ + " from"
1141+ + " information_schema.columns "
1142+ + " where"
1143+ + " table_name = ? "
1144+ + " order by ordinal_position"
9681145 };
9691146 protected static String sql_proc[] = {
9701147 "select text from user_source where type = ? and name = ? order by line",
@@ -1041,6 +1218,29 @@ public class CmnProps{
10411218 + ") a "
10421219 + "where "
10431220 + " a.object_type = ? "
1221+ + " and a.object_name = ? ",
1222+ "select a.definition "
1223+ + "from "
1224+ + "( "
1225+ + "select "
1226+ + " routine_name as object_name, "
1227+ + " routine_type as object_type, "
1228+ + " routine_definition as definition "
1229+ + "from "
1230+ + " information_schema.routines "
1231+ + "where "
1232+ + " routine_schema = current_schema() "
1233+ + "union select "
1234+ + " trigger_name as object_name, "
1235+ + " 'TRIGGER' as object_type, "
1236+ + " action_statement as definition "
1237+ + "from "
1238+ + " information_schema.triggers "
1239+ + "where "
1240+ + " trigger_schema = current_schema() "
1241+ + ") a "
1242+ + "where "
1243+ + " a.object_type = ? "
10441244 + " and a.object_name = ? "
10451245 };
10461246
--- a/com/rapide_act/RapideMetaUnloader.java
+++ b/com/rapide_act/RapideMetaUnloader.java
@@ -169,7 +169,7 @@ public class RapideMetaUnloader{
169169 cp = new CmnProps();
170170 cp.setProperty(database);
171171
172- if (cp.dbType > cp.DB_TYPE_DB2 || cp.dbType <0){
172+ if (cp.dbType > cp.DB_TYPE_POSTGRESQL || cp.dbType <0){
173173 throw new Exception("データベースが対象外です。[" + cp.DB_TYPE_NAME[cp.dbType] + "]");
174174 }
175175 if(cp.outFolder != null){
Show on old repository browser