Firebird Utilities in C #

1

How do I use library resources Firebird in C# : FbValidation , FbLog and FbStatistical ? I did not find any documentation of Firebird that could help me.

    
asked by anonymous 22.09.2016 / 00:53

1 answer

1

Maybe their implementation will help you.

FbValidation.cs :

using System;

using FirebirdSql.Data.Common;

namespace FirebirdSql.Data.Firebird.Services
{
    #region Enumerations

    /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/overview/*'/>
    [Flags]
    public enum FbValidationFlags
    {
        /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="ValidateDatabase"]/*'/>
        ValidateDatabase    = 0x01,
        /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="SweepDatabase"]/*'/>
        SweepDatabase       = 0x02,
        /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="MendDatabase"]/*'/>
        MendDatabase        = 0x04,
        /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="CheckDatabase"]/*'/>
        CheckDatabase       = 0x10,
        /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="IgnoreChecksum"]/*'/>
        IgnoreChecksum      = 0x20,
        /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="KillShadows"]/*'/>
        KillShadows         = 0x40,
        /// <include file='Doc/en_EN/FbValidation.xml' path='doc/struct[@name="FbValidationFlags"]/field[@name="Full"]/*'/>
        Full                = 0x80
    }

    #endregion

    /// <include file='Doc/en_EN/FbValidation.xml' path='doc/class[@name="FbValidation"]/overview/*'/>
    public sealed class FbValidation : FbService
    {
        #region Fields

        private FbValidationFlags   options;

        #endregion

        #region Properties

        /// <include file='Doc/en_EN/FbValidation.xml' path='doc/class[@name="FbValidation"]/property[@name="Options"]/*'/>
        public FbValidationFlags Options
        {
            get { return this.options; }
            set { this.options = value; }
        }       

        #endregion

        #region Constructors

        /// <include file='Doc/en_EN/FbValidation.xml' path='doc/class[@name="FbValidation"]/constructor[@name="ctor"]/*'/>
        public FbValidation() : base()
        {
        }

        #endregion

        #region Methods

        /// <include file='Doc/en_EN/FbValidation.xml' path='doc/class[@name="FbValidation"]/method[@name="Start"]/*'/>
        public void Start()
        {           
            // Configure Spb
            this.StartSpb = new SpbBuffer();
            this.StartSpb.Append(IscCodes.isc_action_svc_repair);
            this.StartSpb.Append(
                IscCodes.isc_spb_dbname, 
                this.Parameters.Database);
            this.StartSpb.Append(
                IscCodes.isc_spb_options, 
                (int)this.options);

            // Start execution
            this.StartTask();
        }

        #endregion
    }
}


FbLog.cs :

using System;

using FirebirdSql.Data.Common;

namespace FirebirdSql.Data.Firebird.Services
{
    /// <include file='Doc/en_EN/FbLog.xml' path='doc/class[@name="FbLog"]/overview/*'/>
    public sealed class FbLog : FbService
    {       
        #region Constructors

        /// <include file='Doc/en_EN/FbLog.xml' path='doc/class[@name="FbLog"]/constructor[@name="ctor"]/*'/>
        public FbLog() : base()
        {           
        }

        #endregion

        #region Methods

        /// <include file='Doc/en_EN/FbLog.xml' path='doc/class[@name="FbLog"]/method[@name="Start"]/*'/>
        public void Start()
        {       
            // Configure Spb
            this.StartSpb = new SpbBuffer();
            this.StartSpb.Append(IscCodes.isc_action_svc_get_ib_log);

            // Start execution
            this.StartTask();
        }

        #endregion      
    }
}


FbStatistical.cs :

using System;

using FirebirdSql.Data.Common;

namespace FirebirdSql.Data.Firebird.Services
{
    #region Enumerations

    /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/overview/*'/>
    [Flags]
    public enum FbStatisticalFlags
    {
        /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="DataPages"]/*'/>
        DataPages               = 0x01,
        /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="DatabaseLog"]/*'/>
        DatabaseLog             = 0x02,
        /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="HeaderPages"]/*'/>
        HeaderPages             = 0x04,
        /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="IndexPages"]/*'/>
        IndexPages              = 0x08,
        /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/enum[@name="FbStatisticalFlags"]/field[@name="SystemTablesRelations"]/*'/>
        SystemTablesRelations   = 0x10,
    }

    #endregion

    /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/class[@name="FbStatistical"]/overview/*'/>
    public sealed class FbStatistical : FbService
    {
        #region Fields

        private FbStatisticalFlags  options;

        #endregion

        #region Properties

        /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/class[@name="FbStatistical"]/property[@name="Options"]/*'/>
        public FbStatisticalFlags Options
        {
            get { return this.options; }
            set { this.options = value; }
        }

        #endregion

        #region Constructors

        /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/class[@name="FbStatistical"]/constructor[@name="FbStatistical"]/*'/>
        public FbStatistical() : base()
        {
        }

        #endregion

        #region Methods

        /// <include file='Doc/en_EN/FbStatistical.xml' path='doc/class[@name="FbStatistical"]/constructor[@name="Start"]/*'/>
        public void Start()
        {       
            // Configure Spb
            this.StartSpb = new SpbBuffer();
            this.StartSpb.Append(IscCodes.isc_action_svc_db_stats);
            this.StartSpb.Append(
                IscCodes.isc_spb_dbname, 
                this.Parameters.Database);
            this.StartSpb.Append(
                IscCodes.isc_spb_options, 
                (int)this.options);

            // Start execution
            this.StartTask();
        }

        #endregion      
    }
}


Links that may be useful:

22.09.2016 / 02:49