Esempio n. 1
0
        static internal ArgumentException InvalidMultipartNameIncorrectUsageOfQuotes(string property, string value)
        {
            ArgumentException e = new ArgumentException(Res.GetString(Res.ADP_InvalidMultipartNameQuoteUsage, Res.GetString(property), value));

            return(e);
        }
Esempio n. 2
0
        static internal ArgumentException InvalidMultipartName(string property, string value)
        {
            ArgumentException e = new ArgumentException(Res.GetString(Res.ADP_InvalidMultipartName, Res.GetString(property), value));

            return(e);
        }
Esempio n. 3
0
        static internal InvalidOperationException MethodCalledTwice(string method)
        {
            InvalidOperationException e = new InvalidOperationException(Res.GetString(Res.ADP_CalledTwice, method));

            return(e);
        }
Esempio n. 4
0
        static internal PlatformNotSupportedException DbTypeNotSupported(string dbType)
        {
            PlatformNotSupportedException e = new PlatformNotSupportedException(Res.GetString(Res.SQL_DbTypeNotSupportedOnThisPlatform, dbType));

            return(e);
        }
Esempio n. 5
0
        // Write data of specified length into the SqlBytes from specified offset
        public void Write(long offset, byte[] buffer, int offsetInBuffer, int count)
        {
            if (FStream())
            {
                if (m_stream.Position != offset)
                {
                    m_stream.Seek(offset, SeekOrigin.Begin);
                }
                m_stream.Write(buffer, offsetInBuffer, count);
            }
            else
            {
                // Validate the arguments
                if (buffer == null)
                {
                    throw new ArgumentNullException("buffer");
                }

                if (m_rgbBuf == null)
                {
                    throw new SqlTypeException(Res.GetString(Res.SqlMisc_NoBufferMessage));
                }

                if (offset < 0)
                {
                    throw new ArgumentOutOfRangeException("offset");
                }
                if (offset > m_rgbBuf.Length)
                {
                    throw new SqlTypeException(Res.GetString(Res.SqlMisc_BufferInsufficientMessage));
                }

                if (offsetInBuffer < 0 || offsetInBuffer > buffer.Length)
                {
                    throw new ArgumentOutOfRangeException("offsetInBuffer");
                }

                if (count < 0 || count > buffer.Length - offsetInBuffer)
                {
                    throw new ArgumentOutOfRangeException("count");
                }

                if (count > m_rgbBuf.Length - offset)
                {
                    throw new SqlTypeException(Res.GetString(Res.SqlMisc_BufferInsufficientMessage));
                }

                if (IsNull)
                {
                    // If NULL and there is buffer inside, we only allow writing from
                    // offset zero.
                    //
                    if (offset != 0)
                    {
                        throw new SqlTypeException(Res.GetString(Res.SqlMisc_WriteNonZeroOffsetOnNullMessage));
                    }

                    // treat as if our current length is zero.
                    // Note this has to be done after all inputs are validated, so that
                    // we won't throw exception after this point.
                    //
                    _lCurLen = 0;
                    _state   = SqlBytesCharsState.Buffer;
                }
                else if (offset > _lCurLen)
                {
                    // Don't allow writing from an offset that this larger than current length.
                    // It would leave uninitialized data in the buffer.
                    //
                    throw new SqlTypeException(Res.GetString(Res.SqlMisc_WriteOffsetLargerThanLenMessage));
                }

                if (count != 0)
                {
                    // ProjectK\Core doesn't support long-typed array indexers
                    Debug.Assert(offset < int.MaxValue);
                    Array.Copy(buffer, offsetInBuffer, m_rgbBuf, checked ((int)offset), count);

                    // If the last position that has been written is after
                    // the current data length, reset the length
                    if (_lCurLen < offset + count)
                    {
                        _lCurLen = offset + count;
                    }
                }
            }

            AssertValid();
        }
Esempio n. 6
0
 static public Exception InvalidOffsetLength()
 {
     return(_Argument(Res.GetString(Res.Data_InvalidOffsetLength)));
 }