Sets a blob parameter for the prepared statement.

@param ps
@param i
@param o
@param cls
@throws SQLException
320369
private static void setBlob(PreparedStatement ps, int i, Object o, Class<?> cls)
            throws SQLException {
        final InputStream is;
        if (o instanceof byte[]) {
            is = new ByteArrayInputStream((byte[]) o);
        }
1297730
private static <T> T executeQuery(PreparedStatement ps, RsHandler<T> rsh) throws SQLException {
		ResultSet rs = null;
		try {
			rs = ps.executeQuery();
			return rsh.handle(rs);
		} finally {
			DbUtil.close(rs);
		}
	}
1093688
protected final void doInsert(Connection c) throws SQLException {
		PreparedStatement stmt = null;
		try {
			stmt = c.prepareStatement("insert into foo values (?, ?)  ");
			stmt.setInt(1, rand.nextInt(99999));
			stmt.setString(2, "This is a text");
			stmt.executeUpdate();
		} finally {
			if (stmt != null) {
				stmt.close();
			}
		}
	}
189090
@Override
    public void setBlob(String parameterName, InputStream inputStream) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
763921
public void setNullForStatement(PreparedStatement ps, int index, int sqlType) throws SQLException
    {
        ps.setNull(index, sqlType);
    }
1265989
private PreparedStatement createPreparedStatement(String query, int fetchSize, Object... params) throws SQLException {
        PreparedStatement stat = connection.prepareStatement(query);
        stat.setFetchSize(fetchSize);
        for (int i = 0; i < params.length; i++) {
            stat.setObject(i + 1, params[i]);
        }
        return stat;
    }
11028
public void bindArgument(@NotNull PreparedStatement ps, int index, @Nullable Object value) throws SQLException {
        ArgumentBinder.bindArgument(ps, index, value);
    }
144128
protected PreparedStatement createStatment(Connection conn, Sql sql) throws SQLException {

		if (sql == null) {
			throw new NullPointerException("Sql Object is NULL");
		}
		String sqlBody = sql.getSql();

		if (StringUtils.isNotEmpty(sqlBody)) {
			PreparedStatement stmt = null;
			if (sql.isProcedure()) {
				stmt = conn.prepareCall("{" + sqlBody + "}");
			} else if (sql.isPreperStatement()) {
				stmt = conn.prepareStatement(sqlBody);
			}
			
			if (stmt != null) {
				Map<Integer, Object> prepareValues = sql.getPreperValues();
	
				Set<Integer> indexSet = prepareValues.keySet();
				for (Integer index : indexSet) {
					Object value = prepareValues.get(index);
					if (index != null && value != null) {
						if (value instanceof String) {
							stmt.setString(index, value.toString());
						} else if (value instanceof Integer) {
							stmt.setInt(index, ((Integer) value).intValue());
						} else if (value instanceof Long) {
							stmt.setLong(index, ((Long) value).longValue());
						} else if (value instanceof Double) {
							stmt.setDouble(index, ((Double) value).doubleValue());
						} else if (value instanceof Float) {
							stmt.setFloat(index, ((Float) value).floatValue());
						} else if (value instanceof Short) {
							stmt.setShort(index, ((Short) value).shortValue());
						} else if (value instanceof Byte) {
							stmt.setByte(index, ((Byte) value).byteValue());
						} else if (value instanceof Boolean) {
							stmt.setBoolean(index, ((Boolean) value).booleanValue());
						} else if (value instanceof Date) {
							stmt.setDate(index, (Date) value);
						} else if (value instanceof Time) {
							stmt.setTime(index, (Time) value, Calendar.getInstance());
						} else if (value instanceof Blob) {
							stmt.setBlob(index, (Blob) value);
						} else if (value instanceof Clob) {
							stmt.setClob(index, (Clob) value);
						} else if (value instanceof BigDecimal) {
							stmt.setBigDecimal(index, (BigDecimal) value);
						} else if (value instanceof byte[]) {
							stmt.setBytes(index, (byte[]) value);
						} else if (value instanceof Out) {
							if (stmt instanceof CallableStatement) {
								int outType = getProcedureOutType((Out)value);
								if (outType != -999) {
									((CallableStatement)stmt).registerOutParameter(index, outType);
								}
							}
						} else {
							stmt.setObject(index, value);
						}
					}
				}
				return stmt;
			} else {
				return conn.prepareStatement(sqlBody);
			}
		}
433984
@Override
    public void setBlob(String parameterName, Blob x) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
39325
public void execute(String query, Object... params) throws SQLException {
        createPreparedStatement(query, 0, params).execute();
    }
1136152
public int setParameter(final PreparedStatement preparedStatement, final int index,
			final BindParameterMapperManager parameterMapperManager) throws SQLException {
		return setInParameter(preparedStatement, index, parameterMapperManager);
	}
491129
public static PreparedStatement fillParams(PreparedStatement ps, Object... params) throws SQLException {
		if (ArrayUtil.isEmpty(params)) {
			return ps;// 无参数
		}
		Object param;
		for (int i = 0; i < params.length; i++) {
			int paramIndex = i + 1;
			param = params[i];
			if (null != param) {
				if (param instanceof java.util.Date) {
					// 日期特殊处理
					if (param instanceof java.sql.Date) {
						ps.setDate(paramIndex, (java.sql.Date) param);
					} else if (param instanceof java.sql.Time) {
						ps.setTime(paramIndex, (java.sql.Time) param);
					} else {
						ps.setTimestamp(paramIndex, SqlUtil.toSqlTimestamp((java.util.Date) param));
					}
				} else if (param instanceof Number) {
					// 针对大数字类型的特殊处理
					if (param instanceof BigInteger) {
						// BigInteger转为Long
						ps.setLong(paramIndex, ((BigInteger) param).longValue());
					} else if (param instanceof BigDecimal) {
						// BigDecimal的转换交给JDBC驱动处理
						ps.setBigDecimal(paramIndex, (BigDecimal) param);
					} else {
						// 普通数字类型按照默认传入
						ps.setObject(paramIndex, param);
					}
				} else {
					ps.setObject(paramIndex, param);
				}
			} else {
				final ParameterMetaData pmd = ps.getParameterMetaData();
				int sqlType = Types.VARCHAR;
				try {
					sqlType = pmd.getParameterType(paramIndex);
				} catch (SQLException e) {
					// ignore
					// log.warn("Null param of index [{}] type get failed, by: {}", paramIndex, e.getMessage());
				}
				ps.setNull(paramIndex, sqlType);
			}
		}
		return ps;
	}
1089498
@Override
    public void setNClob(int parameterIndex, Reader reader) throws SQLException {
        internalStmt.setNClob(parameterIndex, reader);
    }
546602
@Override
    public void setClob(String parameterName, Clob x) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
279940
@Override
	public void updateBlob(final String columnLabel, final Blob x) throws SQLException {
		wrapped.updateBlob(columnLabel, x);
	}
1339399
public function s2o($sql, $params = null, $class_name = '', $prepare_and_store = 1)
    {

        try {
            return parent::s2o($sql, $params, $class_name, $prepare_and_store);
        } catch (\Exception $e) {
            throw(new \sb\PDO\Exception('CALLED: ' . __METHOD__ . "\nERROR RETURNED: " . print_r($e, 1)));
        }
    }
893588
public static void setPStmt(int type, PreparedStatement pstmt, Object value, int i) throws SQLException {
        switch (type) {
            case Types.BIT:
            case Types.BOOLEAN:
                if (value instanceof Boolean) {
                    pstmt.setBoolean(i, (Boolean) value);
                } else if (value instanceof String) {
                    boolean v = !value.equals("0");
                    pstmt.setBoolean(i, v);
                } else if (value instanceof Number) {
                    boolean v = ((Number) value).intValue() != 0;
                    pstmt.setBoolean(i, v);
                } else {
                    pstmt.setNull(i, type);
                }
                break;
            case Types.CHAR:
            case Types.NCHAR:
            case Types.VARCHAR:
            case Types.LONGVARCHAR:
                if (value instanceof String) {
                    pstmt.setString(i, (String) value);
                } else if (value == null) {
                    pstmt.setNull(i, type);
                } else {
                    pstmt.setString(i, value.toString());
                }
                break;
            case Types.TINYINT:
                if (value instanceof Number) {
                    pstmt.setByte(i, ((Number) value).byteValue());
                } else if (value instanceof String) {
                    pstmt.setByte(i, Byte.parseByte((String) value));
                } else {
                    pstmt.setNull(i, type);
                }
                break;
            case Types.SMALLINT:
                if (value instanceof Number) {
                    pstmt.setShort(i, ((Number) value).shortValue());
                } else if (value instanceof String) {
                    pstmt.setShort(i, Short.parseShort((String) value));
                } else {
                    pstmt.setNull(i, type);
                }
                break;
            case Types.INTEGER:
                if (value instanceof Number) {
                    pstmt.setInt(i, ((Number) value).intValue());
                } else if (value instanceof String) {
                    pstmt.setInt(i, Integer.parseInt((String) value));
                } else {
                    pstmt.setNull(i, type);
                }
                break;
            case Types.BIGINT:
                if (value instanceof Number) {
                    pstmt.setLong(i, ((Number) value).longValue());
                } else if (value instanceof String) {
                    pstmt.setLong(i, Long.parseLong((String) value));
                } else {
                    pstmt.setNull(i, type);
                }
                break;
            case Types.DECIMAL:
            case Types.NUMERIC:
                if (value instanceof BigDecimal) {
                    pstmt.setBigDecimal(i, (BigDecimal) value);
                } else if (value instanceof Byte) {
                    pstmt.setInt(i, ((Byte) value).intValue());
                } else if (value instanceof Short) {
                    pstmt.setInt(i, ((Short) value).intValue());
                } else if (value instanceof Integer) {
                    pstmt.setInt(i, (Integer) value);
                } else if (value instanceof Long) {
                    pstmt.setLong(i, (Long) value);
                } else if (value instanceof Float) {
                    pstmt.setBigDecimal(i, new BigDecimal((float) value));
                } else if (value instanceof Double) {
                    pstmt.setBigDecimal(i, new BigDecimal((double) value));
                } else if (value != null) {
                    pstmt.setBigDecimal(i, new BigDecimal(value.toString()));
                } else {
                    pstmt.setNull(i, type);
                }
                break;
            case Types.REAL:
                if (value instanceof Number) {
                    pstmt.setFloat(i, ((Number) value).floatValue());
                } else if (value instanceof String) {
                    pstmt.setFloat(i, Float.parseFloat((String) value));
                } else {
                    pstmt.setNull(i, type);
                }
                break;
            case Types.FLOAT:
            case Types.DOUBLE:
                if (value instanceof Number) {
                    pstmt.setDouble(i, ((Number) value).doubleValue());
                } else if (value instanceof String) {
                    pstmt.setDouble(i, Double.parseDouble((String) value));
                } else {
                    pstmt.setNull(i, type);
                }
                break;
            case Types.BINARY:
            case Types.VARBINARY:
            case Types.LONGVARBINARY:
            case Types.BLOB:
                if (value instanceof Blob) {
                    pstmt.setBlob(i, (Blob) value);
                } else if (value instanceof byte[]) {
                    pstmt.setBytes(i, (byte[]) value);
                } else if (value instanceof String) {
                    pstmt.setBytes(i, ((String) value).getBytes(StandardCharsets.ISO_8859_1));
                } else {
                    pstmt.setNull(i, type);
                }
                break;
            case Types.CLOB:
                if (value instanceof Clob) {
                    pstmt.setClob(i, (Clob) value);
                } else if (value instanceof byte[]) {
                    pstmt.setBytes(i, (byte[]) value);
                } else if (value instanceof String) {
                    Reader clobReader = new StringReader((String) value);
                    pstmt.setCharacterStream(i, clobReader);
                } else {
                    pstmt.setNull(i, type);
                }
                break;
            case Types.DATE:
                if (value instanceof java.sql.Date) {
                    pstmt.setDate(i, (java.sql.Date) value);
                } else if (value instanceof java.util.Date) {
                    pstmt.setDate(i, new java.sql.Date(((java.util.Date) value).getTime()));
                } else if (value instanceof String) {
                    String v = (String) value;
                    if (!v.startsWith("0000-00-00")) {
                        java.util.Date date = Util.parseDate(v);
                        if (date != null) {
                            pstmt.setDate(i, new Date(date.getTime()));
                        } else {
                            pstmt.setNull(i, type);
                        }
                    } else {
                        pstmt.setObject(i, value);
                    }
                } else {
                    pstmt.setNull(i, type);
                }
                break;
            case Types.TIME:
                if (value instanceof java.sql.Time) {
                    pstmt.setTime(i, (java.sql.Time) value);
                } else if (value instanceof java.util.Date) {
                    pstmt.setTime(i, new java.sql.Time(((java.util.Date) value).getTime()));
                } else if (value instanceof String) {
                    String v = (String) value;
                    java.util.Date date = Util.parseDate(v);
                    if (date != null) {
                        pstmt.setTime(i, new Time(date.getTime()));
                    } else {
                        pstmt.setNull(i, type);
                    }
                } else {
                    pstmt.setNull(i, type);
                }
                break;
            case Types.TIMESTAMP:
                if (value instanceof java.sql.Timestamp) {
                    pstmt.setTimestamp(i, (java.sql.Timestamp) value);
                } else if (value instanceof java.util.Date) {
                    pstmt.setTimestamp(i, new java.sql.Timestamp(((java.util.Date) value).getTime()));
                } else if (value instanceof String) {
                    String v = (String) value;
                    if (!v.startsWith("0000-00-00")) {
                        java.util.Date date = Util.parseDate(v);
                        if (date != null) {
                            pstmt.setTimestamp(i, new Timestamp(date.getTime()));
                        } else {
                            pstmt.setNull(i, type);
                        }
                    } else {
                        pstmt.setObject(i, value);
                    }
                } else {
                    pstmt.setNull(i, type);
                }
                break;
            default:
                pstmt.setObject(i, value, type);
        }