Exemple #1
0
        protected static bool CheckCommandExecution(ThrowawayDatabase fixture)
        {
            using var connection = fixture.OpenConnection();

            using var cmd = new SqlCommand("SELECT 1", connection);
            return(Convert.ToInt32(cmd.ExecuteScalar()) == 1);
        }
Exemple #2
0
        public static string GetCollation(ThrowawayDatabase fixture, string name = null)
        {
            using var connection = fixture.OpenConnection();

            using var cmd = new SqlCommand("SELECT collation_name FROM sys.databases WHERE name = @name", connection);
            cmd.Parameters.AddWithValue("name", name ?? fixture.Name);

            return(Convert.ToString(cmd.ExecuteScalar()));
        }
        public static string GetCollation(ThrowawayDatabase fixture, string name = null)
        {
            using var connection = fixture.OpenConnection();

            using var cmd = new MySqlCommand("SELECT default_collation_name FROM information_schema.schemata WHERE schema_name = @name LIMIT 1", connection);
            cmd.Parameters.AddWithValue("name", name ?? fixture.Name);

            return(Convert.ToString(cmd.ExecuteScalar()));
        }
Exemple #4
0
            static IEnumerable <int> GetItems(ThrowawayDatabase fixture)
            {
                using var connection = fixture.OpenConnection();

                using var cmd    = new MySqlCommand($"SELECT * FROM {tblTest}", connection);
                using var reader = cmd.ExecuteReader();

                while (reader.Read() && reader.HasRows)
                {
                    yield return(reader.GetInt32(0));
                }
            }