本文整理汇总了Java中org.pentaho.di.core.row.ValueMetaInterface.isStorageBinaryString方法的典型用法代码示例。如果您正苦于以下问题:Java ValueMetaInterface.isStorageBinaryString方法的具体用法?Java ValueMetaInterface.isStorageBinaryString怎么用?Java ValueMetaInterface.isStorageBinaryString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.row.ValueMetaInterface
的用法示例。
在下文中一共展示了ValueMetaInterface.isStorageBinaryString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatField
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
* Takes an input field and converts it to bytes to be stored in the temp file.
* @param v The metadata about the column
* @param valueData The column data
* @return The bytes for the value
* @throws KettleValueException
*/
private byte[] formatField( ValueMetaInterface v, Object valueData ) throws KettleValueException {
if ( v.isString() ) {
if ( v.isStorageBinaryString() && v.getTrimType() == ValueMetaInterface.TRIM_TYPE_NONE && v.getLength() < 0
&& Const.isEmpty( v.getStringEncoding() ) ) {
return (byte[]) valueData;
} else {
String svalue = ( valueData instanceof String ) ? (String) valueData : v.getString( valueData );
// trim or cut to size if needed.
//
return convertStringToBinaryString( v, Const.trimToType( svalue, v.getTrimType() ) );
}
} else {
return v.getBinaryString( valueData );
}
}
示例2: formatField
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private byte[] formatField(ValueMetaInterface v, Object valueData) throws KettleValueException
{
if( v.isString() )
{
if (v.isStorageBinaryString()
&& v.getTrimType()==ValueMetaInterface.TRIM_TYPE_NONE
&& v.getLength()<0
&& Const.isEmpty(v.getStringEncoding())
) {
return (byte[])valueData;
} else {
String svalue = (valueData instanceof String)?(String)valueData:v.getString(valueData);
// trim or cut to size if needed.
//
return convertStringToBinaryString(v,Const.trimToType(svalue, v.getTrimType()));
}
}
else
{
return v.getBinaryString(valueData);
}
}
示例3: formatField
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private byte[] formatField(ValueMetaInterface v, Object valueData) throws KettleValueException {
if (v.isString()) {
if (v.isStorageBinaryString() && v.getTrimType() == ValueMetaInterface.TRIM_TYPE_NONE && v.getLength() < 0
&& Const.isEmpty( v.getStringEncoding())) {
return (byte[]) valueData;
} else {
String svalue = (valueData instanceof String) ? (String) valueData : v.getString(valueData);
// trim or cut to size if needed.
return convertStringToBinaryString(v, Const.trimToType(svalue, v.getTrimType()));
}
} else {
return v.getBinaryString(valueData);
}
}
示例4: processRow
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{
meta=(MySQLBulkLoaderMeta)smi;
data=(MySQLBulkLoaderData)sdi;
try
{
Object[] r=getRow(); // Get row from input rowset & set row busy!
if (r==null) // no more input to be expected...
{
setOutputDone();
closeOutput();
return false;
}
if (first)
{
first=false;
// Cache field indexes.
//
data.keynrs = new int[meta.getFieldStream().length];
for (int i=0;i<data.keynrs.length;i++) {
data.keynrs[i] = getInputRowMeta().indexOfValue(meta.getFieldStream()[i]);
}
data.bulkFormatMeta = new ValueMetaInterface[data.keynrs.length];
for (int i=0;i<data.keynrs.length;i++) {
ValueMetaInterface sourceMeta = getInputRowMeta().getValueMeta(data.keynrs[i]);
if (sourceMeta.isDate()) {
if (meta.getFieldFormatType()[i]==MySQLBulkLoaderMeta.FIELD_FORMAT_TYPE_DATE) {
data.bulkFormatMeta[i] = data.bulkDateMeta.clone();
} else if (meta.getFieldFormatType()[i]==MySQLBulkLoaderMeta.FIELD_FORMAT_TYPE_TIMESTAMP) {
data.bulkFormatMeta[i] = data.bulkTimestampMeta.clone(); // default to timestamp
}
} else if (sourceMeta.isNumeric() && meta.getFieldFormatType()[i]==MySQLBulkLoaderMeta.FIELD_FORMAT_TYPE_NUMBER) {
data.bulkFormatMeta[i] = data.bulkNumberMeta.clone();
}
if (data.bulkFormatMeta[i]==null && !sourceMeta.isStorageBinaryString()) {
data.bulkFormatMeta[i] = sourceMeta.clone();
}
}
// execute the client statement...
//
execute(meta);
}
// Every nr of rows we re-start the bulk load process to allow indexes etc to fit into the MySQL server memory
// Performance could degrade if we don't do this.
//
if (data.bulkSize>0 && getLinesOutput()>0 && (getLinesOutput()%data.bulkSize)==0) {
closeOutput();
executeLoadCommand();
}
writeRowToBulk(getInputRowMeta(), r);
putRow(getInputRowMeta(), r);
incrementLinesOutput();
return true;
}
catch(Exception e)
{
logError(Messages.getString("MySQLBulkLoader.Log.ErrorInStep"), e); //$NON-NLS-1$
setErrors(1);
stopAll();
setOutputDone(); // signal end to receiver(s)
return false;
}
}
示例5: processRow
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{
meta=(MySQLBulkLoaderMeta)smi;
data=(MySQLBulkLoaderData)sdi;
try
{
Object[] r=getRow(); // Get row from input rowset & set row busy!
if (r==null) // no more input to be expected...
{
setOutputDone();
closeOutput();
return false;
}
if (first)
{
first=false;
// Cache field indexes.
//
data.keynrs = new int[meta.getFieldStream().length];
for (int i=0;i<data.keynrs.length;i++) {
data.keynrs[i] = getInputRowMeta().indexOfValue(meta.getFieldStream()[i]);
}
data.bulkFormatMeta = new ValueMetaInterface[data.keynrs.length];
for (int i=0;i<data.keynrs.length;i++) {
ValueMetaInterface sourceMeta = getInputRowMeta().getValueMeta(data.keynrs[i]);
if (sourceMeta.isDate()) {
if (meta.getFieldFormatType()[i]==MySQLBulkLoaderMeta.FIELD_FORMAT_TYPE_DATE) {
data.bulkFormatMeta[i] = data.bulkDateMeta.clone();
} else if (meta.getFieldFormatType()[i]==MySQLBulkLoaderMeta.FIELD_FORMAT_TYPE_TIMESTAMP) {
data.bulkFormatMeta[i] = data.bulkTimestampMeta.clone(); // default to timestamp
}
} else if (sourceMeta.isNumeric() && meta.getFieldFormatType()[i]==MySQLBulkLoaderMeta.FIELD_FORMAT_TYPE_NUMBER) {
data.bulkFormatMeta[i] = data.bulkNumberMeta.clone();
}
if (data.bulkFormatMeta[i]==null && !sourceMeta.isStorageBinaryString()) {
data.bulkFormatMeta[i] = sourceMeta.clone();
}
}
// execute the client statement...
//
execute(meta);
}
// Every nr of rows we re-start the bulk load process to allow indexes etc to fit into the MySQL server memory
// Performance could degrade if we don't do this.
//
if (data.bulkSize>0 && getLinesOutput()>0 && (getLinesOutput()%data.bulkSize)==0) {
closeOutput();
executeLoadCommand();
}
writeRowToBulk(getInputRowMeta(), r);
putRow(getInputRowMeta(), r);
incrementLinesOutput();
return true;
}
catch(Exception e)
{
logError(BaseMessages.getString(PKG, "MySQLBulkLoader.Log.ErrorInStep"), e); //$NON-NLS-1$
setErrors(1);
stopAll();
setOutputDone(); // signal end to receiver(s)
return false;
}
}
示例6: getValueFromResultSet
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
* This method allows a database dialect to convert database specific data types to Kettle data types.
*
* @param resultSet The result set to use
* @param valueMeta The description of the value to retrieve
* @param index the index on which we need to retrieve the value, 0-based.
* @return The correctly converted Kettle data type corresponding to the valueMeta description.
* @throws KettleDatabaseException
*/
public Object getValueFromResultSet(ResultSet rs, ValueMetaInterface val, int i) throws KettleDatabaseException {
Object data = null;
try {
switch (val.getType()) {
case ValueMetaInterface.TYPE_BOOLEAN:
data = Boolean.valueOf(rs.getBoolean(i + 1));
break;
case ValueMetaInterface.TYPE_NUMBER:
data = new Double(rs.getDouble(i + 1));
break;
case ValueMetaInterface.TYPE_BIGNUMBER:
data = rs.getBigDecimal(i + 1);
break;
case ValueMetaInterface.TYPE_INTEGER:
data = Long.valueOf(rs.getLong(i + 1));
break;
case ValueMetaInterface.TYPE_STRING:
if (val.isStorageBinaryString()) {
data = rs.getBytes(i + 1);
} else {
data = rs.getString(i + 1);
}
break;
case ValueMetaInterface.TYPE_BINARY:
if (supportsGetBlob()) {
Blob blob = rs.getBlob(i + 1);
if (blob != null) {
data = blob.getBytes(1L, (int) blob.length());
} else {
data = null;
}
} else {
data = rs.getBytes(i + 1);
}
break;
case ValueMetaInterface.TYPE_DATE:
if (val.getOriginalColumnType() == java.sql.Types.TIME) {
// Neoview can not handle getDate / getTimestamp for a Time column
data = rs.getTime(i + 1);
break; // Time is a subclass of java.util.Date, the default date
// will be 1970-01-01
} else if (val.getPrecision() != 1 && supportsTimeStampToDateConversion()) {
data = rs.getTimestamp(i + 1);
break; // Timestamp extends java.util.Date
} else {
data = rs.getDate(i + 1);
break;
}
default:
break;
}
if (rs.wasNull()) {
data = null;
}
} catch(SQLException e) {
throw new KettleDatabaseException("Unable to get value '"+val.toStringMeta()+"' from database resultset, index "+i, e);
}
return data;
}
示例7: getValueFromResultSet
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
* This method allows a database dialect to convert database specific data types to Kettle data types.
*
* @param resultSet The result set to use
* @param valueMeta The description of the value to retrieve
* @param index the index on which we need to retrieve the value, 0-based.
* @return The correctly converted Kettle data type corresponding to the valueMeta description.
* @throws KettleDatabaseException
*/
public Object getValueFromResultSet(ResultSet rs, ValueMetaInterface val, int i) throws KettleDatabaseException {
Object data = null;
try {
switch (val.getType()) {
case ValueMetaInterface.TYPE_BOOLEAN:
data = Boolean.valueOf(rs.getBoolean(i + 1));
break;
case ValueMetaInterface.TYPE_NUMBER:
data = new Double(rs.getDouble(i + 1));
break;
case ValueMetaInterface.TYPE_BIGNUMBER:
data = rs.getBigDecimal(i + 1);
break;
case ValueMetaInterface.TYPE_INTEGER:
data = Long.valueOf(rs.getLong(i + 1));
break;
case ValueMetaInterface.TYPE_STRING:
if (val.isStorageBinaryString()) {
data = rs.getBytes(i + 1);
} else {
data = rs.getString(i + 1);
}
break;
case ValueMetaInterface.TYPE_BINARY:
if (supportsGetBlob()) {
Blob blob = rs.getBlob(i + 1);
if (blob != null) {
data = blob.getBytes(1L, (int) blob.length());
} else {
data = null;
}
} else {
data = rs.getBytes(i + 1);
}
break;
case ValueMetaInterface.TYPE_DATE:
if (val.getPrecision() != 1 && supportsTimeStampToDateConversion()) {
data = rs.getTimestamp(i + 1);
break; // Timestamp extends java.util.Date
} else {
data = rs.getDate(i + 1);
break;
}
default:
break;
}
if (rs.wasNull()) {
data = null;
}
} catch(SQLException e) {
throw new KettleDatabaseException("Unable to get value '"+val.toStringMeta()+"' from database resultset, index "+i, e);
}
return data;
}