• R/O
  • HTTP
  • SSH
  • HTTPS

rapideact: Commit


Commit MetaInfo

Revision2ebcf90c6a36423b9279b31cea7fce9351c4f018 (tree)
Time2017-06-25 08:08:13
Authorkuboryu <kuboryu@yaho...>
Commiterkuboryu

Log Message

20170625

Change Summary

Incremental Difference

--- a/com/rapide_act/CmnProps.java
+++ b/com/rapide_act/CmnProps.java
@@ -68,14 +68,6 @@ public class CmnProps{
6868 ";" + System.getProperty("line.separator"),
6969 ";" + System.getProperty("line.separator")
7070 };
71- protected static final String [] SQL_TERMINATOR2 = {
72- ";",
73- System.getProperty("line.separator") + "GO",
74- ";",
75- ";",
76- ";",
77- ";"
78- };
7971 protected static final String [] SQL_PREFIX = {
8072 "@",
8173 ":r ",
@@ -793,6 +785,129 @@ public class CmnProps{
793785 + " and a.constraint_name = b.constraint_name "
794786 + " and b.referenced_table_name = c.table_name "
795787 + " and b.referenced_column_name = c.column_name "
788+ },
789+ { //DB2
790+ "select "
791+ + " a.tabname,"
792+ + " replace(replace(a.remarks, chr(13), ''), chr(10), '') as table_comments, "
793+ + " b.colname,"
794+ + " replace(replace(b.remarks, chr(13), ''), chr(10), '') as column_comments, "
795+ + " b.typename,"
796+ + " b.length as data_length, "
797+ + " b.length as data_precision, "
798+ + " b.scale as data_scale, "
799+ + " case b.nulls"
800+ + " when '0' then '〇'"
801+ + " else null "
802+ + " end as nullable,"
803+ + " b.default as data_default "
804+ + " from"
805+ + " syscat.tables a,"
806+ + " syscat.columns b"
807+ + " where"
808+ + " a.tabschema = current_schema"
809+ + " and a.tabschema = b.tabschema"
810+ + " and a.tabname = b.tabname"
811+ + " and a.ownertype = 'U'"
812+ + " and a.type = 'T'"
813+ + " order by a.tabname,b.colno",
814+ "select "
815+ + " a.tabname as table_name,"
816+ + " a.indname as index_name,"
817+ + " '' as index_type,"
818+ + " case a.uniquerule"
819+ + " when 'P' then 'P'"
820+ + " when 'U' then 'U'"
821+ + " else null "
822+ + " end as constraint_type,"
823+ + " b.colname as column_name,"
824+ + " b.colseq as column_position"
825+ + " from"
826+ + " syscat.indexes a,"
827+ + " syscat.indexcoluse b"
828+ + " where"
829+ + " a.indschema = current_schema"
830+ + " and a.indschema = b.indschema"
831+ + " and a.indname = b.indname"
832+ + " order by"
833+ + " a.tabname,"
834+ + " a.indname,"
835+ + " b.colseq",
836+ "select "
837+ + " tabname as view_name,"
838+ + " replace(replace(remarks, chr(13), ''), chr(10), '') as comments "
839+ + " from"
840+ + " syscat.tables "
841+ + " where"
842+ + " tabschema = current_schema"
843+ + " and type='V' "
844+ + " order by"
845+ + " tabname",
846+ "select "
847+ + " routinename as object_name, "
848+ + " case routinetype"
849+ + " when 'F' then 'FUNCTION'"
850+ + " when 'P' then 'PROCEDURE'"
851+ + " end as object_type "
852+ + " from "
853+ + " syscat.routines "
854+ + " where "
855+ + " routineschema = current_schema "
856+ + "union all "
857+ + "select "
858+ + " trigname as object_name, "
859+ + " 'TRIGGER' as object_type "
860+ + "from "
861+ + " syscat.triggers "
862+ + "where "
863+ + " trigschema = current_schema "
864+ + " order by object_name",
865+ "select "
866+ + " seqname as sequence_name,"
867+ + " to_char(minvalue) as min_value,"
868+ + " to_char(maxvalue) as max_value,"
869+ + " to_char(increment) as increment_by,"
870+ + " cycle as cycle_flag,"
871+ + " order as order_flag,"
872+ + " to_char(cache) as cache_size,"
873+ + " to_char(nextcachefirstvalue) as last_number "
874+ + " from syscat.sequences "
875+ + " where "
876+ + " seqschema = current_schema "
877+ + " order by seqname",
878+ "select "
879+ + " tabname as synonym_name,"
880+ + " base_tabschema as table_owner,"
881+ + " base_tabname as table_name,"
882+ + " '' as db_link "
883+ + "from syscat.tables "
884+ + " where type = 'A' "
885+ + " and ownertype = 'U'"
886+ + " and tabschema = current_schema "
887+ + "order by synonym_name,table_owner,table_name",
888+ "",
889+ "select distinct "
890+ + " a.tabname as table_name, "
891+ + " a.constname as constraint_name, "
892+ + " b.colname as column_name, "
893+ + " b.colseq as position,"
894+ + " c.tabname as r_table_name, "
895+ + " c.colname as r_column_name, "
896+ + " c.colseq as r_position "
897+ + " from "
898+ + " syscat.references a, "
899+ + " syscat.keycoluse b,"
900+ + " syscat.keycoluse c"
901+ + " where "
902+ + " a.tabschema = current_schema"
903+ + " and a.constname = b.constname"
904+ + " and a.tabschema = b.tabschema"
905+ + " and a.tabname = b.tabname"
906+ + " and a.refkeyname = c.constname"
907+ + " and a.reftabschema = c.tabschema"
908+ + " and a.reftabname = c.tabname"
909+ + " order by"
910+ + " a.tabname,a.constname,b.colseq,c.colseq"
796911 }
797912 };
798913 protected static String sql_view_text[] = {
@@ -804,7 +919,8 @@ public class CmnProps{
804919 + "inner join sys.sql_modules c "
805920 + "on c.object_id = b.object_id "
806921 + "where a.name = ?",
807- "select view_definition from information_schema.views where table_name = ?"
922+ "select view_definition from information_schema.views where table_name = ?",
923+ "select text from syscat.views where viewname= ?"
808924 };
809925 protected static String sql_view_column_and_comment[] = {
810926 "select "
@@ -836,7 +952,16 @@ public class CmnProps{
836952 + " information_schema.columns "
837953 + " where"
838954 + " table_name = ? "
839- + " order by ordinal_position"
955+ + " order by ordinal_position",
956+ "select "
957+ + " colname as column_name,"
958+ + " replace(replace(remarks, chr(13), ''), chr(10), '') as column_comments "
959+ + " from"
960+ + " syscat.columns "
961+ + " where"
962+ + " tabschema = current_schema"
963+ + " and tabname = ?"
964+ + " order by colno"
840965 };
841966 protected static String sql_proc[] = {
842967 "select text from user_source where type = ? and name = ? order by line",
@@ -885,6 +1010,34 @@ public class CmnProps{
8851010 + ") a "
8861011 + "where "
8871012 + " a.object_type = ? "
1013+ + " and a.object_name = ? ",
1014+ "select "
1015+ + " a.definition "
1016+ + " from "
1017+ + "( "
1018+ + "select "
1019+ + " routinename as object_name, "
1020+ + " case routinetype"
1021+ + " when 'F' then 'FUNCTION'"
1022+ + " when 'P' then 'PROCEDURE'"
1023+ + " end as object_type, "
1024+ + " text as definition "
1025+ + " from "
1026+ + " syscat.routines "
1027+ + " where "
1028+ + " routineschema = current_schema "
1029+ + "union all "
1030+ + "select "
1031+ + " trigname as object_name, "
1032+ + " 'TRIGGER' as object_type, "
1033+ + " text as definition "
1034+ + "from "
1035+ + " syscat.triggers "
1036+ + "where "
1037+ + " trigschema = current_schema "
1038+ + ") a "
1039+ + "where "
1040+ + " a.object_type = ? "
8881041 + " and a.object_name = ? "
8891042 };
8901043
--- a/com/rapide_act/RapideMetaLoader.java
+++ b/com/rapide_act/RapideMetaLoader.java
@@ -191,6 +191,7 @@ public class RapideMetaLoader{
191191 strMltLine += _cp.inColLineSeparator + strLine;
192192 }
193193 }
194+ strMltLine += _cp.lineSeparator;
194195 if(_isReplace){
195196 if(!strMltLine.equals("")){
196197 try {
@@ -211,14 +212,11 @@ public class RapideMetaLoader{
211212 }
212213 }
213214 } else {
214- if (_cp.dbType == _cp.DB_TYPE_MYSQL){
215- sqlLine = CmnUtils.split(strMltLine, _cp.SQL_TERMINATOR[_cp.dbType]);
216- } else {
217- sqlLine = CmnUtils.split(strMltLine, _cp.SQL_TERMINATOR2[_cp.dbType]);
218- }
215+ sqlLine = CmnUtils.split(strMltLine, _cp.SQL_TERMINATOR[_cp.dbType]);
219216 for(int l = 0;l<sqlLine.length;l++){
220- if(!sqlLine[l].equals("")){
217+ if(!sqlLine[l].equals("") && !sqlLine[l].equals(_cp.lineSeparator)){
221218 try {
219+ CmnUtils.debugPrint("'" + sqlLine[l] + "'");
222220 if (_cp.dbType == _cp.DB_TYPE_ORACLE){
223221 _stmt = _dao.prepareSql(sqlLine[l].replaceAll("\r",""));
224222 } else {
--- 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_MYSQL || cp.dbType <0){
172+ if (cp.dbType > cp.DB_TYPE_DB2 || cp.dbType <0){
173173 throw new Exception("データベースが対象外です。[" + cp.DB_TYPE_NAME[cp.dbType] + "]");
174174 }
175175 if(cp.outFolder != null){
Show on old repository browser