示例#1
0
 /// <summary>
 /// Gets information about columns for a given table, view or procedure.
 /// </summary>
 /// <param name="Object">
 /// Table, view or procedure to get information about.
 /// </param>
 /// <returns>A Datatable with the column schema for the given object.</returns>
 public DataTable GetColumnSchema(string Object)
 {
     string [] Restrictions = new string[4] {
         null, null, Object, null
     };
     return(Cn.GetSchema("Columns", Restrictions));
 }
示例#2
0
        /// <summary>
        /// Gets the SQL executed by a given VIEW.
        /// </summary>
        /// <returns>
        /// The source of the given view.
        /// </returns>
        public virtual string GetViewSQL(string View)
        {
            DataTable dt;

            dt = Cn.GetSchema
                     ("Views", new string[] { null, null, View });
            return((string)dt.Rows[0]["VIEW_DEFINITION"]);
        }
示例#3
0
        /// <summary>
        /// Gets the SQL executed by a given procedure.
        /// </summary>
        /// <returns>
        /// The source of the given procedure.
        /// </returns>
        public virtual string GetProcedureSQL(string Procedure)
        {
            DataTable dt;

            dt = Cn.GetSchema
                     ("Procedures", new string[] { null, null, Procedure, null });
            return((string)dt.Rows[0]["PROCEDURE_DEFINITION"]);
        }
示例#4
0
        /// <summary>
        /// Gets the names of the columns in a table
        /// </summary>
        /// <param name="Table">The Name of the table</param>
        /// <returns>The column names as an array of strings.</returns>
        public override string [] GetColumnNames(string Table)
        {
            DataTable dt = new DataTable();
            int       numCols;

            string [] Tables;

            dt      = Cn.GetSchema("Columns", new string [] { null, null, Table, null });
            numCols = dt.Rows.Count;
            Tables  = new string[numCols];
            for (int i = 0; i < numCols; i++)
            {
                Tables[i] = (string)dt.Rows[i]["COLUMN_NAME"];
            }
            return(Tables);
        }
示例#5
0
        /// <summary>
        /// Gets a list of tables in the database.
        /// </summary>
        /// <returns>
        /// A list of table names as an array of strings.
        /// </returns>
        public virtual string [] GetTables()
        {
            int RowCount;
            int i = 0;

            string [] Tables;
            DataTable dt = null;

            dt       = Cn.GetSchema("tables");
            RowCount = dt.Rows.Count;
            Tables   = new string[RowCount];
            for (i = 0; i < RowCount; i++)
            {
                Tables[i] = (string)dt.Rows[i]["TABLE_NAME"];
            }
            return(Tables);
        }
示例#6
0
        /// <summary>
        /// Gets a list of Views in the database.
        /// </summary>
        /// <returns>
        /// A list of views names as an array of strings.
        /// </returns>
        public string [] GetViews()
        {
            int numCols;
            int i = 0;

            string [] Tables;

            DataTable dt = null;

            dt      = Cn.GetSchema("views");
            numCols = dt.Rows.Count;
            Tables  = new string[numCols];
            for (i = 0; i < numCols; i++)
            {
                Tables[i] = (string)dt.Rows[i]["TABLE_NAME"];
            }

            return(Tables);
        }
示例#7
0
        /// <summary>
        /// Gets a list of Procedures in the database.
        /// </summary>
        /// <returns>
        /// A list of Procedures names as an array of strings.
        /// </returns>
        public virtual string [] GetProcedures()
        {
            int numCols;
            int i = 0;

            string [] Tables;

            DataTable dt = null;

            dt      = Cn.GetSchema("procedures");
            numCols = dt.Rows.Count;
            Tables  = new string[numCols];
            for (i = 0; i < numCols; i++)
            {
                Tables[i] = (string)dt.Rows[i]["PROCEDURE_NAME"];
            }

            return(Tables);
        }
示例#8
0
 /// <summary>
 /// Gets database schema.
 /// </summary>
 /// <param name="Collection">The name of the collection to retrieve.</param>
 /// <returns>
 /// A datatable with schema information about the database
 /// </returns>
 public virtual DataTable GetSchema(string Collection)
 {
     return(Cn.GetSchema(Collection));
 }
示例#9
0
 /// <summary>
 /// Gets database schema.
 /// </summary>
 /// <returns>
 /// A datatable of what I believe to be useless information. I believe
 /// you can use the first column to determins the schema types you can
 /// return.
 /// </returns>
 public virtual DataTable GetSchema()
 {
     return(Cn.GetSchema());
 }