⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sqllongvarbit.java

📁 derby database source code.good for you.
💻 JAVA
字号:
/*   Derby - Class org.apache.derby.iapi.types.SQLLongVarbit   Copyright 1999, 2004 The Apache Software Foundation or its licensors, as applicable.   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.apache.derby.iapi.types;import org.apache.derby.iapi.types.DataTypeDescriptor;import org.apache.derby.iapi.types.DataValueDescriptor;import org.apache.derby.iapi.types.TypeId;import org.apache.derby.iapi.types.BitDataValue;import org.apache.derby.iapi.types.DataValueDescriptor;import org.apache.derby.iapi.reference.SQLState;import org.apache.derby.iapi.error.StandardException;import org.apache.derby.iapi.types.Orderable;import org.apache.derby.iapi.services.io.FormatIdUtil;import org.apache.derby.iapi.services.io.StoredFormatIds;import org.apache.derby.iapi.services.sanity.SanityManager;import org.apache.derby.iapi.types.BooleanDataValue;import org.apache.derby.iapi.types.StringDataValue;import org.apache.derby.iapi.types.NumberDataValue;import java.io.ObjectOutput;import java.io.ObjectInput;import java.io.IOException;import java.sql.ResultSet;import java.sql.SQLException;/** * SQLLongVarbit satisfies the DataValueDescriptor * interfaces (i.e., OrderableDataType). It implements a String holder, * e.g. for storing a column value; it can be specified * when constructed to not allow nulls. Nullability cannot be changed * after construction. * <p> * Because OrderableDataType is a subclass of DataType, * SQLLongVarbit can play a role in either a DataType/Value * or a OrderableDataType/KeyRow, interchangeably. * * It is an extension of SQLVarbit and is virtually indistinguishable * other than normalization. */public class SQLLongVarbit extends SQLVarbit{	public String getTypeName()	{		return TypeId.LONGVARBIT_NAME;	}	/**	 * @see DataValueDescriptor#getNewNull	 */	public DataValueDescriptor getNewNull()	{		return new SQLLongVarbit();	}	/** 	 * @see DataValueDescriptor#setValueFromResultSet 	 *	 * @exception SQLException		Thrown on error	 */	public void setValueFromResultSet(ResultSet resultSet, int colNumber,									  boolean isNullable)		throws SQLException	{			stream = resultSet.getBinaryStream(colNumber);			dataValue = null;	}	/**		Return my format identifier.		@see org.apache.derby.iapi.services.io.TypedFormat#getTypeFormatId	*/	public int getTypeFormatId()	{		return StoredFormatIds.SQL_LONGVARBIT_ID;	}	/*	 * Orderable interface	 */	/*	 * Column interface	 */	/*	 * class interface	 */	/*	 * constructors	 */	public SQLLongVarbit()	{	}	public SQLLongVarbit(byte[] val)	{		super(val);	}	/**	 * Normalization method - this method may be called when putting	 * a value into a SQLVarbit, for example, when inserting into a SQLVarbit	 * column.  See NormalizeResultSet in execution.	 *	 * This overrides SQLBit -- the difference is that we don't	 * expand SQLVarbits to fit the target.	 * 	 * @param desiredType	The type to normalize the source column to	 * @param source		The value to normalize	 *	 *	 * @exception StandardException				Thrown for null into	 *											non-nullable column, and for	 *											truncation error	 */	public void normalize(				DataTypeDescriptor desiredType,				DataValueDescriptor source)					throws StandardException	{		if (source instanceof SQLLongVarbit) {			// avoid creating an object in memory if a matching type.			// this may be a stream.			SQLLongVarbit other = (SQLLongVarbit) source;			this.stream = other.stream;			this.dataValue = other.dataValue;		}		else			((SQLBinary) this).setValue(source.getBytes());	}	/*	 * DataValueDescriptor interface	 */	/** @see DataValueDescriptor#typePrecedence */	public int typePrecedence()	{		return TypeId.LONGVARBIT_PRECEDENCE;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -