예제 #1
0
        public virtual void FillDataTableWithTopX(DatabaseOperationArgs args, DiscoveredTable table, int topX, DataTable dt)
        {
            string sql = GetTopXSqlForTable(table, topX);

            using (var con = args.GetManagedConnection(table))
            {
                using (var cmd = table.Database.Server.GetCommand(sql, con))
                    using (var da = table.Database.Server.GetDataAdapter(cmd))
                        args.Fill(da, cmd, dt);
            }
        }
예제 #2
0
        public override void FillDataTableWithTopX(DatabaseOperationArgs args, DiscoveredTable table, int topX, DataTable dt)
        {
            using (var con = args.GetManagedConnection(table))
            {
                ((OracleConnection)con.Connection).PurgeStatementCache();

                var cols = table.DiscoverColumns();

                //apparently * doesn't fly with Oracle DataAdapter
                string sql = "SELECT " + string.Join(",", cols.Select(c => c.GetFullyQualifiedName()).ToArray()) + " FROM " + table.GetFullyQualifiedName() + " OFFSET 0 ROWS FETCH NEXT " + topX + " ROWS ONLY";

                using (var cmd = table.Database.Server.GetCommand(sql, con))
                    using (var da = table.Database.Server.GetDataAdapter(cmd))
                        args.Fill(da, cmd, dt);
            }
        }