Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (C) 2018 the original author or authors.
*
* Licensed 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 org.cattleframework.db.datasource.reflect.invocation;
import java.lang.reflect.Method;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.cattleframework.db.datasource.DataSourceConstants;
import org.cattleframework.utils.reflect.ReflectUtils;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.reflect.AbstractInvocationHandler;
/**
* 数据库语句调用处理
*
* @author orange
*
*/
public class StatementInvocationHandler extends AbstractInvocationHandler {
private final Logger logger = LoggerFactory.getLogger(getClass());
protected static final String METHOD_NAME_EXECUTE_QUERY = "executeQuery";
protected static final String METHOD_NAME_EXECUTE_UPDATE = "executeUpdate";
protected static final String METHOD_NAME_EXECUTE = "execute";
private static final String SET_OBJECT_METHOD_NAME = "setObject";
private static final String[] SET_METHOD_NAMES = { "setString", "setNString", "setInt", "setFloat", "setShort",
"setDouble", "setBigDecimal", "setLong", "setBoolean" };
private static final String[] DATETIME_SET_METHOD_NAMES = { "setTimestamp", "setDate", "setTime" };
private static final String SET_BINARY_STREAM_METHOD_NAME = "setBinaryStream";
private static final String SET_BLOB_METHOD_NAME = "setBlob";
private static final String[] SET_CLOB_METHOD_NAMES = { "setClob", "setNClob" };
private static final String SET_NULL_METHOD_NAME = "setNull";
private static final String[] SET_CHARACTER_STREAM_METHOD_NAMES = { "setCharacterStream", "setNCharacterStream" };
private static final int DATETIME_SET_METHOD_CALENDAR_ARGS = 3;
protected static final String METHOD_NAME_ADD_BATCH = "addBatch";
private static final String METHOD_NAME_EXECUTE_BATCH = "executeBatch";
private static final String METHOD_NAME_CLEAR_BATCH = "clearBatch";
private static final String METHOD_NAME_CLEAR_PARAMETERS = "clearParameters";
private final Statement target;
private final SortedMap