コード例 #1
0
 /**
  * The main program for the DictCachService class
  *
  * @param args The command line arguments
  */
 public static void main(String[] args) {
   HashMap h = DictCachService.getInstance().getDictSql("select * from tab");
   HashMap h2 = DictCachService.getInstance().getDictSql("select * from tab");
   HashMap hash = DictCachService.getInstance().getDictSql("select code ,name from t_kouan");
   Iterator itor1 = hash.keySet().iterator();
   while (itor1.hasNext()) {
     String code = (String) itor1.next();
     String text = (String) hash.get(code);
     System.out.println(code + "  " + text);
   }
 }
コード例 #2
0
 public String getTextOfDic(String strSql) {
   String returnValue = "";
   Debug.getAppErrLogger().debug("get select text's sql is:" + strSql);
   if (strSql != null && !strSql.equals("")) {
     HashMap hp = getDictSql(strSql);
     Iterator it = hp.keySet().iterator();
     String sText = "";
     while (it.hasNext()) {
       sText = (String) it.next() + ",";
     }
     if (sText.length() > 0 && sText.lastIndexOf(",") == (sText.length() - 1)) {
       sText = sText.substring(0, sText.lastIndexOf(","));
     }
     returnValue = sText;
   }
   return returnValue;
 }