Exemple #1
0
        public SqlNullValuesTests(PlatformSpecificTestContext context)
        {
            fixture   = context.Fixture;
            tableName = fixture.SqlNullValuesTable.Name;
            // Disable the cache to avoid false failures.
            SqlConnection.ColumnEncryptionQueryMetadataCacheEnabled = false;

            foreach (string connStr in DataTestUtility.AEConnStringsSetup)
            {
                // Insert data and create functions for SqlNullValues test.
                using (SqlConnection sqlConnection = new SqlConnection(connStr))
                {
                    sqlConnection.Open();

                    using (SqlCommand cmd = new SqlCommand(string.Format("INSERT INTO [{0}] (c1) VALUES (@c1)", tableName), sqlConnection, null, SqlCommandColumnEncryptionSetting.Enabled))
                    {
                        SqlParameter param = cmd.Parameters.Add("@c1", SqlDbType.Int);
                        param.Value = DBNull.Value;
                        cmd.ExecuteNonQuery();

                        param.Value = 10;
                        cmd.ExecuteNonQuery();
                    }

                    string sql1 = $"CREATE FUNCTION {UdfName}() RETURNS INT AS \n BEGIN \n RETURN (SELECT c1 FROM [{tableName}] WHERE c1 IS NULL)\n END";
                    string sql2 = $"CREATE FUNCTION {UdfNameNotNull}() RETURNS INT AS \n BEGIN \n RETURN (SELECT c1 FROM [{tableName}] WHERE c1 IS NOT NULL)\n END";
                    using (SqlCommand cmd = sqlConnection.CreateCommand())
                    {
                        cmd.CommandText = sql1;
                        cmd.ExecuteNonQuery();

                        cmd.CommandText = sql2;
                        cmd.ExecuteNonQuery();
                    }
                }
            }
        }
Exemple #2
0
 public BulkCopyAE(PlatformSpecificTestContext context)
 {
     fixture   = context.Fixture;
     tableName = fixture.BulkCopyAETestTable.Name;
 }
 public End2EndSmokeTests(PlatformSpecificTestContext context)
 {
     fixture   = context.Fixture;
     tableName = fixture.End2EndSmokeTable.Name;
 }
 public SqlBulkCopyTruncation(PlatformSpecificTestContext context)
 {
     _fixture   = context.Fixture;
     tableNames = _fixture.sqlBulkTruncationTableNames;
 }
 public BulkCopyAEErrorMessage(PlatformSpecificTestContext context)
 {
     _fixture    = context.Fixture;
     _tableName  = _fixture.BulkCopyAEErrorMessageTestTable.Name;
     _columnName = "c1";
 }