2020年11月30日 星期一

4gl 使用 java 來執行查詢

 

大至如下, 在這只是作個註解    

let l_sqlurl =
                "jdbc:sqlserver://172.16.1.xxx:1433;"
                ,"database=mydb;"
                , "user=userid@172.16.1.xxx;"
                , "password=pwdpwdpwd;"
                , "encrypt=true;"
                , "trustServerCertificate=false;"
                , "loginTimeout=30;";

    call java.sql.DriverManager.create() RETURNING l_DrivMan  
    call l_DrivMan.getConnection(l_sqlurl) RETURNING l_conn
    call l_conn.createStatement() returning l_segment
    call l_segment.executeQuery("select * from users") returning l_resultset
      
    while  l_resultset.next()
      Display l_resultset.getString(1)
    end while    

2020年11月8日 星期日

2020年8月20日 星期四

訊光科技EEP , 當流程EEP 為MS SQL . 資料為 ORACLE 時送出流程時會出錯

訊光科技EEP , 當流程EEP 為MS SQL . 資料為 ORACLE 時送出流程時會出錯原因為他把TABLE 加上 [TAB_FILE]   然後去 Oracle 資料庫查.
BUG 是因為
FLRuntime\\HostTable.cs 中


            object[] myRet = remoteModule.CallMethod(clientInfo, "GLModule", "GetDataBaseType", new object[] { DBAlias });   //進這後他會發現流程資料庫為SQL SERVER ,
            if (myRet != null && myRet[0].ToString() == "0")
            {
                /*GW Hanks 修改
                switch (myRet[1].ToString())
                {
                    case "1": table_or_column = _quotePrefix + table_or_column + _quoteSuffix; break;
                  // 所他就把 以下的欄位加上 [ ] 了. 問題是  table_or_column  指的是 Oracle 資料庫
                }*/
            //請改成以下的
                switch (Srvtools.DbConnectionSet.GetDbConn(DBAlias).DbType)
                {
                    case ClientType.ctMsSql:
                        table_or_column = _quotePrefix + table_or_column + _quoteSuffix;
                        break;
                }




注: [ ] 為SQL 的保留字   select [欄位1], [欄位99] from [資料庫A].DBO.[我的表格]
     "" 為 oracle 的select "欄位1", "欄位99" from "我的表格"

訊光科技 EEP 不同資料庫來源錯誤.

訊光科技 EEP 不同資料庫來源錯誤. 
己設定 infocommand 中的 EEPalias 為 ORACLE 的資料庫連線名稱. 可是他在
EFWCFModule\EEPAdpter\Provider.cs 中的 500 行上下
string where = packetInfo.ToQueryString(ClientInfo, sql);
中有一段程式嗎他重組 where 條件時還是使用登入時所使用的設定(SQLSERVER)

我在  public DataSet GetDataSet(string assemblyName,xxxxxxxx)
中加入了以式碼.動態LOAD *.DLL 檔去找他的infoCommand.EEPAlias的設定..如果有指就修改ClientInfo.Database 為 EEPAlias 名稱. 程式碼如下.

            var assemblyFile = PackageProvider.GetAssemblyFile(ClientInfo.Solution, assemblyName);
            Assembly SampleAssembly = Assembly.LoadFrom(assemblyFile);
            var componentType = SampleAssembly.GetType(string.Format("{0}.Component", assemblyName));  //因為所有東西是在專案 Component.cs下
            var myobj = Activator.CreateInstance(componentType);
            foreach (FieldInfo fi in componentType.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance ))
            {
                if (fi.Name.ToUpper().CompareTo(commandName.ToUpper()) == 0)
                {
                    IDbCommand cmd =(IDbCommand)fi.GetValue(myobj);
                    if (cmd is InfoCommand)
                    {
                        if (! string.IsNullOrEmpty((cmd as InfoCommand).EEPAlias))
                        {
                            ClientInfo.Database = (cmd as InfoCommand).EEPAlias; //改這個就可以 因為 packetInfo.ToQueryString 中他會用DataBase重取 Database TYPE
                        }
                    }
                }
            }

2020年2月18日 星期二

4gl triggers all column events between source and target ( before field, after field ...)

測試畫面有五個欄位,  FIELD01 到 FIELD05 ,  輸入的程式如下
    INPUT BY NAME
          g_aa.FIELD01, g_aa.FIELD02, g_aa.FIELD03, g_aa.FIELD04, g_aa.FIELD05
           WITHOUT DEFAULTS
        after field FIELD01
            display "after FIELD01"
        after field FIELD02
            display "after FIELD02"
        after field FIELD03
            display "after FIELD03"          
        after field FIELD04
            display "after FIELD04"
        after field FIELD05
            display "after FIELD05"
    end input
在其他程式的經驗中如果目前是在 FIELD01 上我用滑鼠直接點選FIELD05時. 只會觸發 FIELD01 的 after field (只以after field 來解說發生的狀況). 但是有些裝況下我希望能觸發FIELD01~FIELD04 的after field , 這時可設定參數.
 OPTIONS FIELD ORDER  { CONSTRAINED | UNCONSTRAINED | FORM }

 OPTIONS FIELD ORDER CONSTRAINED


    INPUT BY NAME....
....
....
END INPUT


如加上新的參數後(CONSTRAINED ) 當你的focus 由 FIELD01 直接到 FIELD03 時.. FIELD01, FIELD02 的after field 都會被觸發,

相關說明請看 genero 網站如下.
https://4js.com/online_documentation/fjs-fgl-3.00.05-manual-html/c_fgl_programs_012.html


另一個有關的設定是在PROFILE , 
Dialog.fieldOrder = {true|false}

https://4js.com/online_documentation/fjs-fgl-3.00.05-manual-html/c_fgl_prog_dialogs_fglprofile.html

我沒有時間把其他的東西測完. 之後有空再說