AdpDataReader.cs :  » Persistence-Frameworks » Advanced-Data-Provider » Advanced » Data » Provider » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Persistence Frameworks » Advanced Data Provider 
Advanced Data Provider » Advanced » Data » Provider » AdpDataReader.cs
#region Copyright
// Advanced.Data.Provider.AdpDataReader  
// 
// Copyright (C) 2004 Astrein Engenharia de Manuteno S/A
// Copyright (C) 2004 Everaldo Canuto <everaldo_canuto@yahoo.com.br>
// 
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#endregion

using System;
using System.Data;

namespace Advanced.Data.Provider{
  /// <summary>
  /// Provides a means of reading a forward-only stream of rows from a database server.
  /// </summary>
  public class AdpDataReader : IAdpDataReader
  {
    #region Fields

    internal IDataReader dataReader;

    #endregion

    #region Constructors and destructors

    /// <summary>
    /// Releases the resources used by the <see cref='AdpCommand'/>.
    /// </summary>
    public void Dispose()
    {
    }

    #endregion

    #region Public properties

    /// <summary>
    /// Gets a value indicating the depth of nesting for the current row.
    /// </summary>
    public int Depth
    {
      get
      {
        return dataReader.Depth;
      }
    }

    /// <summary>
    /// Gets the number of columns in the current row.
    /// </summary>
    public int FieldCount
    {
      get
      {
        return dataReader.FieldCount;
      }
    }

    /// <summary>
    /// Gets a value indicating whether the data reader is closed.
    /// </summary>
    public bool IsClosed
    {
      get
      {
        return dataReader.IsClosed;
      }
    }

    /// <summary>
    /// Gets the number of rows changed, inserted, or deleted by execution of the Transact-SQL statement.
    /// </summary>
    public int RecordsAffected
    {
      get
      {
        return dataReader.RecordsAffected;
      }
    }

    /// <summary>
    /// Gets the value of the specified column in its native format given the column name.
    /// </summary>
    /// <param name="name">The column name.</param>
    public object this[string name]
    {
      get
      {
        return dataReader[name];
      }
    }

    /// <summary>
    /// Gets the column located at the specified index.
    /// </summary>
    /// <param name="i">The zero-based column ordinal.</param>
    object System.Data.IDataRecord.this[int i]
    {
      get
      {
        return dataReader[i];
      }
    }

    #endregion

    #region Public methods

    /// <summary>
    /// Closes the <see cref='AdpDataReader'/> object.
    /// </summary>
    public void Close()
    {
      dataReader.Close();
    }

    /// <summary>
    /// Gets a value indicating whether the column contains non-existent or missing values.
    /// </summary>
    /// <param name="i">The zero-based column ordinal.</param>
    /// <returns>true if the specified column value is equivalent to DBNull; otherwise, false.</returns>
    public bool IsDBNull(int i)
    {
      return dataReader.IsDBNull(i);
    }

    /// <summary>
    /// Advances the data reader to the next result, when reading the results of batch Transact-SQL statements.
    /// </summary>
    /// <returns>true if there are more result sets; otherwise, false.</returns>
    public bool NextResult()
    {
      return dataReader.NextResult();
    }

    /// <summary>
    /// Advances the <see cref='AdpDataReader'/> to the next record.
    /// </summary>
    /// <returns>true if there are more rows; otherwise, false.</returns>
    public bool Read()
    {
      return dataReader.Read();
    }

    /// <summary>
    /// Gets the value of the specified column as a Boolean.
    /// </summary>
    /// <param name="i">The zero-based column ordinal.</param>
    /// <returns>The value of the column.</returns>
    public bool GetBoolean(int i)
    {
      return dataReader.GetBoolean(i);
    }

    /// <summary>
    /// Gets the value of the specified column as a byte.
    /// </summary>
    /// <param name="i">The zero-based column ordinal.</param>
    /// <returns>The value of the specified column as a byte.</returns>
    public byte GetByte(int i)
    {
      return dataReader.GetByte(i);
    }

    /// <summary>
    /// Reads a stream of bytes from the specified column offset into the buffer an array starting at the given buffer offset.
    /// </summary>
    /// <param name="i">The zero-based column ordinal.</param>
    /// <param name="fieldOffset">The index within the field from which to begin the read operation.</param>
    /// <param name="buffer">The buffer into which to read the stream of bytes.</param>
    /// <param name="bufferoffset">The index for buffer to begin the read operation.</param>
    /// <param name="length">The number of bytes to read.</param>
    /// <returns>The actual number of bytes read.</returns>
    public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
    {
      return dataReader.GetBytes(i,fieldOffset,buffer,bufferoffset,length);
    }

    /// <summary>
    /// Gets the value of the specified column as a single character.
    /// </summary>
    /// <param name="i">The zero-based column ordinal.</param>
    /// <returns>The value of the specified column.</returns>
    public char GetChar(int i)
    {
      return dataReader.GetChar(i);
    }

    /// <summary>
    /// Reads a stream of characters from the specified column offset into the buffer as an array starting at the given buffer offset.
    /// </summary>
    /// <param name="i">The zero-based column ordinal.</param>
    /// <param name="fieldoffset">The index within the row from which to begin the read operation.</param>
    /// <param name="buffer">The buffer into which to read the stream of bytes.</param>
    /// <param name="bufferoffset">The index for buffer to begin the read operation.</param>
    /// <param name="length">The number of bytes to read.</param>
    /// <returns>The actual number of characters read.</returns>
    public long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
    {
      return dataReader.GetChars(i,fieldoffset,buffer,bufferoffset,length);
    }

    /// <summary>
    /// Gets an <see cref='IDataReader'/> to be used when the field points to more remote structured data.
    /// </summary>
    /// <param name="i">The index of the field to find.</param>
    /// <returns>An <see cref='IDataReader'/> to be used when the field points to more remote structured data.</returns>
    IDataReader System.Data.IDataRecord.GetData(int i)
    {
      AdpDataReader reader=new AdpDataReader();
      reader.dataReader=dataReader.GetData(i);
      return reader;
    }

    /// <summary>
    /// Gets an <see cref='AdpDataReader'/> to be used when the field points to more remote structured data.
    /// </summary>
    /// <param name="i">The index of the field to find.</param>
    /// <returns>An <see cref='AdpDataReader'/> to be used when the field points to more remote structured data.</returns>
    public Advanced.Data.Provider.AdpDataReader GetData(int i)
    {
      return (AdpDataReader)((IDataReader)this).GetData(i);
    }

    /// <summary>
    /// Gets the data type information for the specified field.
    /// </summary>
    /// <param name="i">The index of the field to find.</param>
    /// <returns>The data type information for the specified field.</returns>
    public string GetDataTypeName(int i)
    {
      return dataReader.GetDataTypeName(i);
    }

    /// <summary>
    /// Gets the date and time data value of the spcified field.
    /// </summary>
    /// <param name="i">The index of the field to find.</param>
    /// <returns>The date and time data value of the spcified field.</returns>
    public DateTime GetDateTime(int i)
    {
      return dataReader.GetDateTime(i);
    }

    /// <summary>
    /// Gets the fixed-position numeric value of the specified field.
    /// </summary>
    /// <param name="i">The index of the field to find.</param>
    /// <returns>The fixed-position numeric value of the specified field.</returns>
    public decimal GetDecimal(int i)
    {
      return dataReader.GetDecimal(i);
    }

    /// <summary>
    /// Gets the double-precision floating point number of the specified field.
    /// </summary>
    /// <param name="i">The index of the field to find.</param>
    /// <returns>The double-precision floating point number of the specified field.</returns>
    public double GetDouble(int i)
    {
      return dataReader.GetDouble(i);
    }

    /// <summary>
    /// Gets the Type information corresponding to the type of Object that would be returned from GetValue.
    /// </summary>
    /// <param name="i">The index of the field to find.</param>
    /// <returns>The Type information corresponding to the type of Object that would be returned from GetValue.</returns>
    public Type GetFieldType(int i)
    {
      return dataReader.GetFieldType(i);
    }

    /// <summary>
    /// Gets the single-precision floating point number of the specified field.
    /// </summary>
    /// <param name="i">The index of the field to find.</param>
    /// <returns>The single-precision floating point number of the specified field.</returns>
    public float GetFloat(int i)
    {
      return dataReader.GetFloat(i);
    }

    /// <summary>
    /// Returns the guid value of the specified field.
    /// </summary>
    /// <param name="i">The index of the field to find.</param>
    /// <returns>The guid value of the specified field.</returns>
    public Guid GetGuid(int i)
    {
      return dataReader.GetGuid(i);
    }

    /// <summary>
    /// Gets the 16-bit signed integer value of the specified field.
    /// </summary>
    /// <param name="i">The index of the field to find.</param>
    /// <returns>The 16-bit signed integer value of the specified field.</returns>
    public short GetInt16(int i)
    {
      return dataReader.GetInt16(i);
    }

    /// <summary>
    /// Gets the value of the specified column as a 32-bit signed integer.
    /// </summary>
    /// <param name="i">The zero-based column ordinal.</param>
    /// <returns>TThe 32-bit signed integer value of the specified field.</returns>
    public int GetInt32(int i)
    {
      return dataReader.GetInt32(i);
    }

    /// <summary>
    /// Gets the 64-bit signed integer value of the specified field.
    /// </summary>
    /// <param name="i">The index of the field to find.</param>
    /// <returns>The 64-bit signed integer value of the specified field.</returns>
    public long GetInt64(int i)
    {
      return dataReader.GetInt64(i);
    }

    /// <summary>
    /// Gets the name for the field to find.
    /// </summary>
    /// <param name="i">The index of the field to find.</param>
    /// <returns>The name of the field or the empty string (""), if there is no value to return.</returns>
    public string GetName(int i)
    {
      return dataReader.GetName(i);
    }

    /// <summary>
    /// Return the index of the named field.
    /// </summary>
    /// <param name="name">The name of the field to find.</param>
    /// <returns>The index of the named field.</returns>
    public int GetOrdinal(string name)
    {
      return dataReader.GetOrdinal(name);
    }

    /// <summary>
    /// Returns a <see cref='DataTable'/> that describes the column metadata of the <see cref='AdpDataReader'/>.
    /// </summary>
    /// <returns>A DataTable that describes the column metadata.</returns>
    public DataTable GetSchemaTable()
    {
      return dataReader.GetSchemaTable();
    }

    /// <summary>
    /// Gets the string value of the specified field.
    /// </summary>
    /// <param name="i">The index of the field to find.</param>
    /// <returns>The string value of the specified field.</returns>
    public string GetString(int i)
    {
      return dataReader.GetString(i);
    }

    /// <summary>
    /// Return the value of the specified field.
    /// </summary>
    /// <param name="i">The index of the field to find.</param>
    /// <returns>The Object which will contain the field value upon return.</returns>
    public object GetValue(int i)
    {
      return dataReader.GetValue(i);
    }

    /// <summary>
    /// Gets all the attribute fields in the collection for the current record.
    /// </summary>
    /// <param name="values">An array of Object to copy the attribute fields into.</param>
    /// <returns>The number of instances of Object in the array.</returns>
    public int GetValues(object[] values)
    {
      return dataReader.GetValues(values);
    }

    #endregion
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.