⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sqlcode.java

📁 客户管理系统是一个典型的数据库开发应用程序
💻 JAVA
字号:
package com.tool;


public final class SQLCode {
  private static SQLCode sqlCode = null;
  private static java.util.Properties sqlCodeProperties = new java.util.
      Properties();

  static {
    sqlCode = new SQLCode();
  }

  private SQLCode() {
    _load();
  }

  //取得sqlcode.properties中的sql语句
  public static String getSQLCode(String sqlKey) {
    String sql = "";

    if (sqlCodeProperties.containsKey(sqlKey)) {
      sql = sqlCodeProperties.getProperty(sqlKey);

    }
    return sql;
  }

  public static SQLCode getInstance() {
    return sqlCode;
  }

  //指向sqlcode.properties的位置
  public void _load() {
    String fileName = "/com/tool/sqlCode.properties";
    //通过指定路径找到资源文件存放在fileName中
    sqlCodeProperties.clear();
    //sqlCodeProperties清空

    try {
      java.io.InputStream in = null;
      try {
        in = getClass().getResourceAsStream(fileName);
        //把fileName中存放值放入in字符流中

        sqlCodeProperties.load(in);
      }
      finally {
        in.close();
      }
    }
    catch (java.io.IOException e) {
      System.out.println(e.getMessage());
    }
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -