当前位置: 首页>>代码示例>>Java>>正文


Java BindValue类代码示例

本文整理汇总了Java中com.mysql.jdbc.ServerPreparedStatement.BindValue的典型用法代码示例。如果您正苦于以下问题:Java BindValue类的具体用法?Java BindValue怎么用?Java BindValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BindValue类属于com.mysql.jdbc.ServerPreparedStatement包,在下文中一共展示了BindValue类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setNCharacterStream

import com.mysql.jdbc.ServerPreparedStatement.BindValue; //导入依赖的package包/类
/**
 * @see java.sql.PreparedStatement#setNCharacterStream(int, java.io.Reader, long)
 */
public void setNCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException {
    // can't take if characterEncoding isn't utf8
    if (!this.charEncoding.equalsIgnoreCase("UTF-8") && !this.charEncoding.equalsIgnoreCase("utf8")) {
        throw SQLError.createSQLException("Can not call setNCharacterStream() when connection character set isn't UTF-8", getExceptionInterceptor());
    }

    checkClosed();

    if (reader == null) {
        setNull(parameterIndex, java.sql.Types.BINARY);
    } else {
        BindValue binding = getBinding(parameterIndex, true);
        resetToType(binding, MysqlDefs.FIELD_TYPE_BLOB);

        binding.value = reader;
        binding.isLongData = true;

        if (this.connection.getUseStreamLengthsInPrepStmts()) {
            binding.bindLength = length;
        } else {
            binding.bindLength = -1;
        }
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:28,代码来源:JDBC4ServerPreparedStatement.java

示例2: setNClob

import com.mysql.jdbc.ServerPreparedStatement.BindValue; //导入依赖的package包/类
/**
 * JDBC 4.0 Set a NCLOB parameter.
 * 
 * @param parameterIndex
 *            the first parameter is 1, the second is 2, ...
 * @param reader
 *            the java reader which contains the UNICODE data
 * @param length
 *            the number of characters in the stream
 * 
 * @throws SQLException
 *             if a database error occurs
 */
public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException {
    // can't take if characterEncoding isn't utf8
    if (!this.charEncoding.equalsIgnoreCase("UTF-8") && !this.charEncoding.equalsIgnoreCase("utf8")) {
        throw SQLError.createSQLException("Can not call setNClob() when connection character set isn't UTF-8", getExceptionInterceptor());
    }

    checkClosed();

    if (reader == null) {
        setNull(parameterIndex, java.sql.Types.NCLOB);
    } else {
        BindValue binding = getBinding(parameterIndex, true);
        resetToType(binding, MysqlDefs.FIELD_TYPE_BLOB);

        binding.value = reader;
        binding.isLongData = true;

        if (this.connection.getUseStreamLengthsInPrepStmts()) {
            binding.bindLength = length;
        } else {
            binding.bindLength = -1;
        }
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:38,代码来源:JDBC4ServerPreparedStatement.java

示例3: setNCharacterStream

import com.mysql.jdbc.ServerPreparedStatement.BindValue; //导入依赖的package包/类
/**
 * @see java.sql.PreparedStatement#setNCharacterStream(int, java.io.Reader, long)
 */
public void setNCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException {
    // can't take if characterEncoding isn't utf8
    if (!this.charEncoding.equalsIgnoreCase("UTF-8") && !this.charEncoding.equalsIgnoreCase("utf8")) {
        throw SQLError.createSQLException("Can not call setNCharacterStream() when connection character set isn't UTF-8", getExceptionInterceptor());
    }

    checkClosed();

    if (reader == null) {
        setNull(parameterIndex, java.sql.Types.BINARY);
    } else {
        BindValue binding = getBinding(parameterIndex, true);
        setType(binding, MysqlDefs.FIELD_TYPE_BLOB);

        binding.value = reader;
        binding.isNull = false;
        binding.isLongData = true;

        if (this.connection.getUseStreamLengthsInPrepStmts()) {
            binding.bindLength = length;
        } else {
            binding.bindLength = -1;
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:JDBC4ServerPreparedStatement.java

示例4: setNClob

import com.mysql.jdbc.ServerPreparedStatement.BindValue; //导入依赖的package包/类
/**
 * JDBC 4.0 Set a NCLOB parameter.
 * 
 * @param parameterIndex
 *            the first parameter is 1, the second is 2, ...
 * @param reader
 *            the java reader which contains the UNICODE data
 * @param length
 *            the number of characters in the stream
 * 
 * @throws SQLException
 *             if a database error occurs
 */
public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException {
    // can't take if characterEncoding isn't utf8
    if (!this.charEncoding.equalsIgnoreCase("UTF-8") && !this.charEncoding.equalsIgnoreCase("utf8")) {
        throw SQLError.createSQLException("Can not call setNClob() when connection character set isn't UTF-8", getExceptionInterceptor());
    }

    checkClosed();

    if (reader == null) {
        setNull(parameterIndex, java.sql.Types.NCLOB);
    } else {
        BindValue binding = getBinding(parameterIndex, true);
        setType(binding, MysqlDefs.FIELD_TYPE_BLOB);

        binding.value = reader;
        binding.isNull = false;
        binding.isLongData = true;

        if (this.connection.getUseStreamLengthsInPrepStmts()) {
            binding.bindLength = length;
        } else {
            binding.bindLength = -1;
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:39,代码来源:JDBC4ServerPreparedStatement.java

示例5: setNCharacterStream

import com.mysql.jdbc.ServerPreparedStatement.BindValue; //导入依赖的package包/类
/**
 * @see java.sql.PreparedStatement#setNCharacterStream(int, java.io.Reader,
 *      long)
 */
public void setNCharacterStream(int parameterIndex, Reader reader,
		long length) throws SQLException {
	// can't take if characterEncoding isn't utf8
	if (!this.charEncoding.equalsIgnoreCase("UTF-8")
			&& !this.charEncoding.equalsIgnoreCase("utf8")) {
		throw SQLError
				.createSQLException("Can not call setNCharacterStream() when connection character set isn't UTF-8", getExceptionInterceptor());
	}

	checkClosed();

	if (reader == null) {
		setNull(parameterIndex, java.sql.Types.BINARY);
	} else {
		BindValue binding = getBinding(parameterIndex, true);
		setType(binding, MysqlDefs.FIELD_TYPE_BLOB);

		binding.value = reader;
		binding.isNull = false;
		binding.isLongData = true;

		if (this.connection.getUseStreamLengthsInPrepStmts()) {
			binding.bindLength = length;
		} else {
			binding.bindLength = -1;
		}
	}
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:33,代码来源:JDBC4ServerPreparedStatement.java

示例6: setNClob

import com.mysql.jdbc.ServerPreparedStatement.BindValue; //导入依赖的package包/类
/**
 * JDBC 4.0 Set a NCLOB parameter.
 * 
 * @param parameterIndex
 *            the first parameter is 1, the second is 2, ...
 * @param reader
 *            the java reader which contains the UNICODE data
 * @param length
 *            the number of characters in the stream
 * 
 * @throws SQLException
 *             if a database error occurs
 */
public void setNClob(int parameterIndex, Reader reader, long length)
		throws SQLException {
	// can't take if characterEncoding isn't utf8
	if (!this.charEncoding.equalsIgnoreCase("UTF-8")
			&& !this.charEncoding.equalsIgnoreCase("utf8")) {
		throw SQLError
				.createSQLException("Can not call setNClob() when connection character set isn't UTF-8", getExceptionInterceptor());
	}

	checkClosed();

	if (reader == null) {
		setNull(parameterIndex, java.sql.Types.NCLOB);
	} else {
		BindValue binding = getBinding(parameterIndex, true);
		setType(binding, MysqlDefs.FIELD_TYPE_BLOB);

		binding.value = reader;
		binding.isNull = false;
		binding.isLongData = true;

		if (this.connection.getUseStreamLengthsInPrepStmts()) {
			binding.bindLength = length;
		} else {
			binding.bindLength = -1;
		}
	}
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:42,代码来源:JDBC4ServerPreparedStatement.java


注:本文中的com.mysql.jdbc.ServerPreparedStatement.BindValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。