1. 13 6月, 2019 1 次提交
  2. 12 6月, 2019 1 次提交
  3. 27 5月, 2019 1 次提交
  4. 24 5月, 2019 3 次提交
  5. 23 5月, 2019 3 次提交
  6. 17 5月, 2019 1 次提交
  7. 13 5月, 2019 4 次提交
  8. 10 5月, 2019 2 次提交
  9. 09 5月, 2019 1 次提交
  10. 07 5月, 2019 2 次提交
    • D
      /* · 541547e5
      dailidong 提交于
       * Licensed to the Apache Software Foundation (ASF) under one or more
       * contributor license agreements.  See the NOTICE file distributed with
       * this work for additional information regarding copyright ownership.
       * The ASF licenses this file to You under the Apache License, Version 2.0
       * (the "License"); you may not use this file except in compliance with
       * the License.  You may obtain a copy of the License at
       *
       *    http://www.apache.org/licenses/LICENSE-2.0
       *
       * Unless required by applicable law or agreed to in writing, software
       * distributed under the License is distributed on an "AS IS" BASIS,
       * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       * See the License for the specific language governing permissions and
       * limitations under the License.
       */
      package cn.escheduler.common.utils;
      
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      
      import java.sql.*;
      
      public class MysqlUtils {
      
      	public static final Logger logger = LoggerFactory.getLogger(MysqlUtils.class);
      
      	private static MysqlUtils instance;
      
      	MysqlUtils() {
      	}
      
      	public static MysqlUtils getInstance() {
      		if (null == instance) {
      			syncInit();
      		}
      		return instance;
      	}
      
      	private static synchronized void syncInit() {
      		if (instance == null) {
      			instance = new MysqlUtils();
      		}
      	}
      
      	public void release(ResultSet rs, Statement stmt, Connection conn) {
      		try {
      			if (rs != null) {
      				rs.close();
      				rs = null;
      			}
      		} catch (SQLException e) {
      			logger.error(e.getMessage(),e);
      			throw new RuntimeException(e);
      		} finally {
      			try {
      				if (stmt != null) {
      					stmt.close();
      					stmt = null;
      				}
      			} catch (SQLException e) {
      				logger.error(e.getMessage(),e);
      				throw new RuntimeException(e);
      			} finally {
      				try {
      					if (conn != null) {
      						conn.close();
      						conn = null;
      					}
      				} catch (SQLException e) {
      					logger.error(e.getMessage(),e);
      					throw new RuntimeException(e);
      				}
      			}
      		}
      	}
      
      	public static void releaseResource(ResultSet rs, PreparedStatement ps, Connection conn) {
      		MysqlUtils.getInstance().release(rs,ps,conn);
      		if (null != rs) {
      			try {
      				rs.close();
      			} catch (SQLException e) {
      				logger.error(e.getMessage(),e);
      			}
      		}
      
      		if (null != ps) {
      			try {
      				ps.close();
      			} catch (SQLException e) {
      				logger.error(e.getMessage(),e);
      			}
      		}
      
      		if (null != conn) {
      			try {
      				conn.close();
      			} catch (SQLException e) {
      				logger.error(e.getMessage(),e);
      			}
      		}
      	}
      }
      541547e5
    • B
      add handle escapes % ==> "\\\\%" · a0b0bae1
      baoliang 提交于
      a0b0bae1
  11. 29 4月, 2019 1 次提交
  12. 25 4月, 2019 1 次提交
  13. 24 4月, 2019 1 次提交
  14. 23 4月, 2019 1 次提交
  15. 22 4月, 2019 2 次提交
  16. 17 4月, 2019 1 次提交
  17. 16 4月, 2019 2 次提交
  18. 15 4月, 2019 2 次提交
  19. 13 4月, 2019 2 次提交
  20. 11 4月, 2019 1 次提交
  21. 29 3月, 2019 1 次提交