System.Data.Common.DbDataReader.GetBytes(int, long, byte[], int, int)

Here are the examples of the csharp api class System.Data.Common.DbDataReader.GetBytes(int, long, byte[], int, int) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

21 Examples 7

1. Example

Project: EDDiscovery
Source File: SQLiteCommandED.cs
View license
public override long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length) { return InnerReader.GetBytes(ordinal, dataOffset, buffer, bufferOffset, length); }

2. Example

Project: Glimpse
Source File: GlimpseDbDataReader.cs
View license
public override long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length)
        {
            return InnerDataReader.GetBytes(ordinal, dataOffset, buffer, bufferOffset, length);
        }

3. Example

View license
public override long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferOffset, int length)
            {
                return reader.GetBytes(i, fieldOffset, buffer, bufferOffset, length);
            }

4. Example

Project: ALinq
Source File: AccessDbConnection.cs
View license
public override long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length)
        {
            return source.GetBytes(ordinal, dataOffset, buffer, bufferOffset, length);
        }

5. Example

Project: ALinq
Source File: DataReader.cs
View license
public override long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length)
        {
            return source.GetBytes(ordinal, dataOffset, buffer, bufferOffset, length);
        }

6. Example

Project: ALinq
Source File: Connection.cs
View license
public override long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length)
        {
            return source.GetBytes(ordinal, dataOffset, buffer, bufferOffset, length);
        }

7. Example

Project: ALinq
Source File: Connection.cs
View license
public override long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length)
        {
            return source.GetBytes(ordinal, dataOffset, buffer, bufferOffset, length);
        }

8. Example

Project: referencesource
Source File: DbDataReader.cs
View license
virtual public Stream GetStream(int ordinal) {
            using (MemoryStream bufferStream = new MemoryStream())
            {
                long bytesRead = 0;
                long bytesReadTotal = 0;
                byte[] buffer = new byte[4096];
                do {
                    bytesRead = GetBytes(ordinal, bytesReadTotal, buffer, 0, buffer.Length);
                    bufferStream.Write(buffer, 0, (int)bytesRead);
                    bytesReadTotal += bytesRead;
                } while (bytesRead > 0);
                
                return new MemoryStream(bufferStream.ToArray(), false);
            }
        }

9. Example

Project: nhibernate-core
Source File: ResultSetWrapper.cs
View license
public override long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
		{
			return rs.GetBytes(i, fieldOffset, buffer, bufferoffset, length);
		}

10. Example

View license
public override long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
		{
			return reader.GetBytes(i, fieldOffset, buffer, bufferoffset, length);
		}

11. Example

View license
public override long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
		{
			return _reader.GetBytes(i, fieldOffset, buffer, bufferoffset, length);
		}

12. Example

Project: NServiceKit
Source File: ProfiledDbDataReader.cs
View license
public override long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length)
        {
            return _reader.GetBytes(ordinal, dataOffset, buffer, bufferOffset, length);
        }

13. Example

View license
public override long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length)
        {
            return wrappedReader.GetBytes(ordinal, dataOffset, buffer, bufferOffset, length);
        }

14. Example

View license
public override long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length)
        {
            return _resultsReader.GetBytes(ordinal, dataOffset, buffer, bufferOffset, length);
        }

15. Example

View license
public override int Read(byte[] buffer, int offset, int count)
        {
            //This will throw with the same parameter names if the parameters are not valid.
            ValidateReadParameters(buffer, offset, count);

            try
            {                                                               
                int length = Math.Min(count, (int)(totalBytes - position));
                long bytesRead = 0;
                if(length > 0)
                {
                    bytesRead = reader.GetBytes(ordinal, position, buffer, offset, length);
                    position += bytesRead;
                }

                return (int)bytesRead;
            }
            catch(DbException dex)
            {
                //It's not OK to throw non-IOExceptions from a Stream.
                throw new IOException(dex.Message, dex);
            }
        }

16. Example

Project: MimeKit
Source File: X509CertificateDatabase.cs
View license
static int ReadBinaryBlob (DbDataReader reader, int column, ref byte[] buffer)
		{
#if NETSTANDARD
			buffer = reader.GetFieldValue<byte[]> (column);
			return (int) buffer.Length;
#else
			long nread;

			// first, get the length of the buffer needed
			if ((nread = reader.GetBytes (column, 0, null, 0, buffer.Length)) > buffer.Length)
				Array.Resize (ref buffer, (int) nread);

			// read the certificate data
			return (int) reader.GetBytes (column, 0, buffer, 0, (int) nread);
#endif
		}

17. Example

Project: ALinq
Source File: DataReader.cs
View license
public override Guid GetGuid(int ordinal)
        {
            var value = GetValue(ordinal);
            if (value == null)
                return Guid.Empty;

            if (value is Byte[])
            {
                var buffer = (Byte[])value;
                source.GetBytes(ordinal, 0, buffer, 0, 16);
                return new Guid(buffer);
            }
            if (value is string)
                return new Guid((string) value);

            return Guid.Empty;
        }

18. Example

View license
public override object Get(DbDataReader rs, int index, ISessionImplementor session)
		{
			int length = (int) rs.GetBytes(index, 0, null, 0, 0);
			byte[] buffer = new byte[length];
			if (length > 0)
			{
				// The "if" is to make happy MySQL NH-2096
				rs.GetBytes(index, 0, buffer, 0, length);
			}
			return ToExternalFormat(buffer);
		}

19. Example

View license
public override int Read(byte[] buffer, int offset, int count)
        {
            //This will throw with the same parameter names if the parameters are not valid.
            ValidateReadParameters(buffer, offset, count);

            try
            {                                                               
                int length = Math.Min(count, (int)(totalBytes - position));
                long bytesRead = 0;
                if(length > 0)
                {
                    bytesRead = reader.GetBytes(ordinal, position, buffer, offset, length);
                    position += bytesRead;
                }

                return (int)bytesRead;
            }
            catch(DbException dex)
            {
                //It's not OK to throw non-IOExceptions from a Stream.
                throw new IOException(dex.Message, dex);
            }
        }

20. Example

View license
public override long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length)
        {
            WaitForReaderOrThrow();
            ThrowIfPseudoColumnReference(ordinal);
            return this.GetCurrentDataReader().GetBytes(ordinal, dataOffset, buffer, bufferOffset, length);
        }

21. Example

View license
private static async Task FlushSqlResultsToStream(DbDataReader reader, Stream stream, CancellationTo/n ..... /n //View Source file for more details /n }