Ejemplo n.º 1
0
        private void execQuery()
        {
            if (hasExecuted)
            {
                return;
            }
            if (Query == null)
            {
                Query = "select count(*) from " + TableName + (Where != null ? " where " + Where : "");
                DbCommand dc = environment.CreateCommand(Query, CommandType.Text);
                object    o  = dc.ExecuteScalar();
                dc.Dispose();
                if (o != null)
                {
                    _rows = Convert.ToInt32(o);
                }
            }
            else
            {
                DbCommand dc = environment.CreateCommand(Query, CommandType.Text);
                environment.BindFixtureSymbols(Symbols, dc);

                DbDataAdapter oap = environment.DbProviderFactory.CreateDataAdapter();
                oap.SelectCommand = dc;
                DataSet ds = new DataSet();
                oap.Fill(ds);
                dc.Dispose();
                _rows = ds.Tables[0].Rows.Count;
            }
            hasExecuted = true;
        }
Ejemplo n.º 2
0
        public static DataTable GetDataTable(String query,IDbEnvironment environment)
        {
            DbCommand dc = environment.CreateCommand(query, CommandType.Text);
            if (Options.ShouldBindSymbols())
                environment.BindFixtureSymbols(dc);

            DbDataAdapter oap = environment.DbProviderFactory.CreateDataAdapter();
            oap.SelectCommand = dc;
            var ds = new DataSet();
            oap.Fill(ds);
            dc.Dispose();
            return ds.Tables[0];
        }
Ejemplo n.º 3
0
 public override void DoRows(Parse rows)
 {
     if (String.IsNullOrEmpty(statement))
     {
         statement = Args[0];
     }
     using (DbCommand dc = environment.CreateCommand(statement, CommandType.Text))
     {
         if (dbfit.util.Options.ShouldBindSymbols())
         {
             environment.BindFixtureSymbols(Symbols, dc);
         }
         dc.ExecuteNonQuery();
     }
 }
Ejemplo n.º 4
0
        public static DataTable GetDataTable(String query, IDbEnvironment environment, int rsNo)
        {
            DbCommand dc = environment.CreateCommand(query, CommandType.Text);

            if (Options.ShouldBindSymbols())
            {
                environment.BindFixtureSymbols(dc);
            }

            DbDataAdapter oap = environment.DbProviderFactory.CreateDataAdapter();

            oap.SelectCommand = dc;
            var ds = new DataSet();

            oap.Fill(ds);
            dc.Dispose();
            return(ds.Tables[rsNo - 1]);
        }
Ejemplo n.º 5
0
        private void InspectQuery(Parse table)
        {
            DbCommand dc = (DbCommand)environment.CreateCommand(objectName, CommandType.Text);

            environment.BindFixtureSymbols(Symbols, dc);

            DbDataAdapter oap = environment.DbProviderFactory.CreateDataAdapter();

            oap.SelectCommand = dc;
            DataSet ds = new DataSet();

            oap.Fill(ds);
            dc.Dispose();
            DataTable dtbl = ds.Tables[0];

            Parse newRow = getHeaderFromRS(dtbl);

            table.Parts.More = newRow;
            foreach (DataRow dr in dtbl.Rows)
            {
                newRow.More = getDataRow(dr);
                newRow      = newRow.More;
            }
        }