Пример #1
0
        public void UnWrap()
        {
            IClob testSubject = NewTestSubject();

            object wrapped = testSubject.UnWrap();

            Assert.IsInstanceOfType(typeof(org.hsqldb.jdbc.jdbcClob), wrapped);
        }
Пример #2
0
        /// <summary>
        /// Retrieves the character position at which the specified
        /// <c>IClob</c> object <c>searchString</c> appears in this
        /// <c>IClob</c> object. The search begins at position
        /// <c>start</c>.
        /// </summary>
        /// <param name="searchString">
        /// The <c>IClob</c> object for which to search.
        /// </param>
        /// <param name="start">
        /// The position at which to begin searching;
        /// the first position is 1.
        /// </param>
        /// <returns>
        /// The position at which the <c>searchString</c> appears or -1
        /// if it is not present; the first position is 1.
        /// </returns>
        /// <exception cref="HsqlDataSourceException">
        /// If there is an error accessing the <c>CLOB</c> value.
        /// </exception>
        long IClob.Position(IClob searchString, long start)
        {
            lock (this)
            {
                CheckFree();

                try
                {
                    java.sql.Clob wrapped
                        = searchString.UnWrap() as java.sql.Clob;

                    if (wrapped == null)
                    {
                        long length = searchString.Length;

                        if (length > int.MaxValue)
                        {
                            throw new ArgumentException(
                                      "Maximum input length exceeded",
                                      "searchString");
                        }

                        // TODO: this is *very* inefficient for large values.
                        string s = searchString.GetSubString(0, (int)length);

                        return(m_clob.position(s, start));
                    }
                    else
                    {
                        return(m_clob.position(wrapped, start));
                    }
                }
                catch (java.sql.SQLException se)
                {
                    throw new HsqlDataSourceException(se);
                }
                catch (java.lang.Exception e)
                {
                    throw new HsqlDataSourceException(e.toString(), e);
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Retrieves the character position at which the specified
        /// <c>IClob</c> object <c>searchString</c> appears in this
        /// <c>IClob</c> object. The search begins at position
        /// <c>start</c>.
        /// </summary>
        /// <param name="searchString">
        /// The <c>IClob</c> object for which to search.
        /// </param>
        /// <param name="start">
        /// The position at which to begin searching;
        /// the first position is 1.
        /// </param>
        /// <returns>
        /// The position at which the <c>searchString</c> appears or -1
        /// if it is not present; the first position is 1.
        /// </returns>
        /// <exception cref="HsqlDataSourceException">
        /// If there is an error accessing the <c>CLOB</c> value.
        /// </exception>
        long IClob.Position(IClob searchString, long start)
        {
            lock (this)
            {
                CheckFree();

                try
                {
                    java.sql.Clob wrapped
                        = searchString.UnWrap() as java.sql.Clob;

                    if (wrapped == null)
                    {
                        long length = searchString.Length;

                        if (length > int.MaxValue)
                        {
                            throw new ArgumentException(
                                "Maximum input length exceeded",
                                "searchString");
                        }

                        // TODO: this is *very* inefficient for large values.
                        string s = searchString.GetSubString(0, (int)length);

                        return m_clob.position(s, start);
                    }
                    else
                    {
                        return m_clob.position(wrapped, start);
                    }
                }
                catch (java.sql.SQLException se)
                {
                    throw new HsqlDataSourceException(se);
                }
                catch (java.lang.Exception e)
                {
                    throw new HsqlDataSourceException(e.toString(), e);
                }
            }
        }