本文整理汇总了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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}