Esempio n. 1
0
        private IList <string> GetAllTables(DbConnection connection)
        {
            var tables = new List <string>();

            string commandText = DbAdapter.BuildTableCommandText(this);

            using (var cmd = connection.CreateCommand())
            {
                cmd.CommandText = commandText;
                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        if (!reader.IsDBNull(0))
                        {
                            tables.Add("\"" + reader.GetString(0) + "\".\"" + reader.GetString(1) + "\"");
                        }
                        else
                        {
                            tables.Add("\"" + reader.GetString(1) + "\"");
                        }
                    }
                }
            }

            return(tables.ToList());
        }
Esempio n. 2
0
        private async Task <IList <string> > GetAllTables(DbConnection connection)
        {
            var tables = new List <string>();

            string commandText = DbAdapter.BuildTableCommandText(this);

            using (var cmd = connection.CreateCommand())
            {
                cmd.CommandText = commandText;
                using (var reader = await cmd.ExecuteReaderAsync())
                {
                    while (await reader.ReadAsync())
                    {
                        if (!await reader.IsDBNullAsync(0))
                        {
                            tables.Add($"{DbAdapter.QuoteCharacter}{reader.GetString(0)}{DbAdapter.QuoteCharacter}.{DbAdapter.QuoteCharacter}{reader.GetString(1)}{DbAdapter.QuoteCharacter}");
                        }
                        else
                        {
                            tables.Add($"{DbAdapter.QuoteCharacter}{reader.GetString(1)}{DbAdapter.QuoteCharacter}");
                        }
                    }
                }
            }

            return(tables.ToList());
        }
Esempio n. 3
0
        private IList <string> GetAllTables(DbConnection connection)
        {
            var tables = new List <string>();

            string commandText = DbAdapter.BuildTableCommandText(this);

            var values = new List <string>();

            values.AddRange(TablesToIgnore ?? Enumerable.Empty <string>());
            values.AddRange(SchemasToExclude ?? Enumerable.Empty <string>());
            values.AddRange(SchemasToInclude ?? Enumerable.Empty <string>());

            using (var cmd = connection.CreateCommand(commandText, values.ToArray()))
            {
                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        if (!reader.IsDBNull(0))
                        {
                            tables.Add("\"" + reader.GetString(0) + "\".\"" + reader.GetString(1) + "\"");
                        }
                        else
                        {
                            tables.Add("\"" + reader.GetString(1) + "\"");
                        }
                    }
                }
            }

            return(tables.ToList());
        }
Esempio n. 4
0
        private async Task <HashSet <Table> > GetAllTables(DbConnection connection)
        {
            var tables = new HashSet <Table>();

            var commandText = DbAdapter.BuildTableCommandText(this);

            using var cmd = connection.CreateCommand();

            cmd.CommandText = commandText;

            using var reader = await cmd.ExecuteReaderAsync();

            while (await reader.ReadAsync())
            {
                tables.Add(new Table(await reader.IsDBNullAsync(0) ? null : reader.GetString(0), reader.GetString(1)));
            }

            return(tables);
        }