public void Can_GetData()
        {
            var target    = new MsSqlReader();
            var dataTable = target.GetData(connectionString, "Select * from SalesLT.CustomerATeam  ");

            dataTable.Tables.Should().NotBeEmpty();
            dataTable.Tables[0].Rows.Should().NotBeEmpty();
        }
Пример #2
0
        private void BtnSqlBuild_Click(object sender, RoutedEventArgs e)
        {
            string connectStr = TxbSqlConnectStr.Text;

            if (string.IsNullOrEmpty(connectStr))
            {
                ShowMessage("请输入数据库连接");
                return;
            }

            var name = string.IsNullOrEmpty(TxbSqlOutputName.Text)
                    ? $"SQL_{DateTime.Now.ToString("yyyyMMddhhmmss")}"
                    : TxbSqlOutputName.Text;

            IReader reader = new MsSqlReader();

            GeneralChm(reader, connectStr, name);
        }
Пример #3
0
        public void CanUploadTable()
        {
            var manifestObject  = GetJsonFile <DatabaseJobManifest>(_inputRoot, "database.job.adventureWorks.json");
            var inputSqlQueries = GetJsonFile <TargetSql>(_inputRoot, "adventureWorks.target.customer.json");
            var data            = CreateTable();

            var target = new MsSqlWriter();

            target.UploadTable(connectionString,
                               inputSqlQueries.SetupTempDml,
                               manifestObject.manifest.tables[1],
                               data,
                               new List <string> {
                inputSqlQueries.UpdateFromTempDml, inputSqlQueries.ClearTempDml
            });

            var reader = new MsSqlReader();
            var result = reader.GetData(connectionString, $"select * from SalesLT.CustomerATeam");

            result.Tables.Should().NotBeEmpty();
            result.Tables[0].Rows.Should().NotBeEmpty();
        }