コード例 #1
0
ファイル: MigratorTest.cs プロジェクト: Mango0000/JRMigrator
        public void VerifyViews()
        {
            List <String> views = mssql.getViews();
            String        view  = "create view birdsname as select birdname from birds";

            Assert.AreEqual(views[0].Trim('\r', '\n').Replace(System.Environment.NewLine, " "), view.Trim('\r', '\n'));
        }
コード例 #2
0
        public void addViews(MSSQLConnection ms, OracleSQLConnection os, CUBRIDConnection cs)
        {
            List <String> views;

            if (ms == null)
            {
                views = os.getViews();
            }
            else
            {
                views = ms.getViews();
            }

            for (int i = 0; i < views.Count; i++)
            {
                try
                {
                    String sql = views[i];
                    if (sql.Contains("dbo.object "))
                    {
                        sql = sql.Replace("dbo.object ", "_object ");
                    }

                    sql = sql.Replace("dbo.", "");
                    sql = sql.Replace("WITH SCHEMABINDING ", " ");
                    sql = sql + ";";
                    //  MessageBox.Show(sql);
                    CUBRIDCommand cmd = new CUBRIDCommand(sql, cs);
                    cmd.ExecuteNonQuery();
                }
                catch (Exception e)
                {
                    if (e.Message.Contains("already exists"))
                    {
                        MessageBox.Show("View konnte nicht erstellt werden.");
                    }
                    else
                    {
                        //    MessageBox.Show(e + "");
                    }
                }
            }
        }