Exemplo n.º 1
0
        public void UnknownConversion()
        {
            object o          = new object();
            int    targetType = java.sql.Types.BIGINT;

            try
            {
                throw HsqlConvert.UnknownConversion(o, targetType);
            }
            catch (HsqlDataSourceException hdse)
            {
                Assert.AreEqual(org.hsqldb.Trace.INVALID_CONVERSION, -hdse.ErrorCode);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// For the current row, gets an instance of the provider-specific
        /// representation of the value of the field with the given column
        /// ordinal.
        /// </summary>
        /// <remarks>
        /// Because this method does not check if this reader
        /// is open or if row data is available, it should be invoked
        /// *only* when it is already known that this reader is open and
        /// row data is available.
        /// </remarks>
        /// <param name="ordinal">The column ordinal.</param>
        /// <returns>The provider-specific value representation.</returns>
        internal object GetProviderSpecificValueInternal(int ordinal)
        {
            object value = m_currentRecord.data[ordinal];

            if (value == null)
            {
                return(null);
            }

            int type = m_metaData.colTypes[ordinal];

            switch (type)
            {
            case (int)HsqlProviderType.Array:
            {
                return(value);
            }

            case (int)HsqlProviderType.BigInt:
            {
                return(value);
            }

            case (int)HsqlProviderType.Binary:
            {
                return(((org.hsqldb.types.Binary)value).getClonedBytes());
            }

            case (int)HsqlProviderType.Blob:
            {
                return(value);
            }

            case (int)HsqlProviderType.Boolean:
            {
                return(value);
            }

            case (int)HsqlProviderType.Char:
            {
                return(value);
            }

            case (int)HsqlProviderType.Clob:
            {
                return(value);
            }

            case (int)HsqlProviderType.DataLink:
            {
                return(value);
            }

            case (int)HsqlProviderType.Date:
            {
                return((java.sql.Date)((java.sql.Date)value).clone());
            }

            case (int)HsqlProviderType.Decimal:
            {
                return(value);
            }

            case (int)HsqlProviderType.Distinct:
            {
                return(value);
            }

            case (int)HsqlProviderType.Double:
            {
                return(value);
            }

            case (int)HsqlProviderType.Float:
            {
                return(value);
            }

            case (int)HsqlProviderType.Integer:
            {
                return(value);
            }

            case (int)HsqlProviderType.JavaObject:
            {
                return(value);
            }

            case (int)HsqlProviderType.LongVarBinary:
            {
                return(((org.hsqldb.types.Binary)value).getClonedBytes());
            }

            case (int)HsqlProviderType.LongVarChar:
            {
                return(value);
            }

            case (int)HsqlProviderType.Null:
            {
                return(null);
            }

            case (int)HsqlProviderType.Numeric:
            {
                return(value);
            }

            case (int)HsqlProviderType.Object:
            {
                byte[] bytes = ((org.hsqldb.types.JavaObject)value).getBytes();
                bool   isJavaObject;

                return(SqlObject.Deserialize(bytes, out isJavaObject));
            }

            case (int)HsqlProviderType.Real:
            {
                return(value);
            }

            case (int)HsqlProviderType.Ref:
            {
                return(value);
            }

            case (int)HsqlProviderType.SmallInt:
            {
                return(value);
            }

            case (int)HsqlProviderType.Struct:
            {
                return(value);
            }

            case (int)HsqlProviderType.Time:
            {
                return((java.sql.Time)((java.sql.Time)value).clone());
            }

            case (int)HsqlProviderType.TimeStamp:
            {
                return((java.sql.Timestamp)((java.sql.Timestamp)value).clone());
            }

            case (int)HsqlProviderType.TinyInt:
            {
                return(value);
            }

            case (int)HsqlProviderType.VarBinary:
            {
                byte[] bytes = ((org.hsqldb.types.Binary)value).getClonedBytes();

                return(new org.hsqldb.types.Binary(bytes, false));
            }

            case (int)HsqlProviderType.VarChar:
            {
                return(value);
            }

            case (int)HsqlProviderType.Xml:
            {
                return(value);
            }

            default:
            {
                throw HsqlConvert.UnknownConversion(value, type);
            }
            }
        }