Esempio n. 1
0
        public void MultiLineQuoteShouldNotIgnoreDoubleQuote()
        {
            string script = "PRINT '" + Environment.NewLine
                            + "''" + Environment.NewLine
                            + "GO" + Environment.NewLine
                            + "/*" + Environment.NewLine
                            + "GO"
                            + "'";

            string[] scripts = BatchSqlParser.SplitBatch(script);

            Assert.AreEqual(1, scripts.Length);
            Assert.AreEqual(script, scripts[0]);
        }
Esempio n. 2
0
        public void TestSplitMultipleGOs()
        {
            string[] scripts = null;
            scripts = BatchSqlParser.SplitBatch(@"
1:1
GO
GO
GO
GO
2:1
");
            //should be 2 scripts
            Assert.AreEqual(2, scripts.Length);
        }
Esempio n. 3
0
 public void TestLeadingTabsSlashStar()
 {
     string[] scripts = null;
     scripts = BatchSqlParser.SplitBatch("\t\t\t\t/* comment */");
     Assert.AreEqual("\t\t\t\t/* comment */", scripts[0]);
 }
Esempio n. 4
0
 public void TestLeadingTabsSingleQuotes()
 {
     string[] scripts = null;
     scripts = BatchSqlParser.SplitBatch("\t\t\t\t'AddProjectToSourceSafe',");
     Assert.AreEqual("\t\t\t\t'AddProjectToSourceSafe',", scripts[0]);
 }
Esempio n. 5
0
 public void TestLeadingTabsParameter()
 {
     string[] scripts = null;
     scripts = BatchSqlParser.SplitBatch("\t\t\t\t@param");
     Assert.AreEqual("\t\t\t\t@param", scripts[0]);
 }
Esempio n. 6
0
 public void TestLeadingTablsDashDash()
 {
     string[] scripts = null;
     scripts = BatchSqlParser.SplitBatch("\t\t\t\t-- comment");
     Assert.AreEqual("\t\t\t\t-- comment", scripts[0]);
 }
Esempio n. 7
0
		public void CanParseSuccessiveGoStatements() {
			const string script = @"GO
GO";
			var scripts = BatchSqlParser.SplitBatch(script);
			Assert.AreEqual(0, scripts.Length, "Expected no scripts since they would be empty.");
		}
Esempio n. 8
0
		public void CanParseSimpleScriptEndingInNewLine() {
			var script = "Test" + Environment.NewLine + "GO" + Environment.NewLine;
			var scripts = BatchSqlParser.SplitBatch(script);
			Assert.AreEqual(1, scripts.Length);
			Assert.AreEqual("Test" + Environment.NewLine, scripts[0]);
		}
Esempio n. 9
0
		public void TestCommentPrecedingGO() {
			var scripts = BatchSqlParser.SplitBatch("/*script1*/GO--script2");
			Assert.AreEqual(2, scripts.Length);
			Assert.AreEqual("/*script1*/", scripts[0]);
			Assert.AreEqual("--script2", scripts[1]);
		}
Esempio n. 10
0
		public void TestCommentFollowingGO() {
			var scripts = BatchSqlParser.SplitBatch("/*script1*/GO/*script2*/");
			Assert.AreEqual(2, scripts.Length);
			Assert.AreEqual("/*script1*/", scripts[0]);
			Assert.AreEqual("/*script2*/", scripts[1]);
		}
Esempio n. 11
0
		public void SemiColonDoesNotSplitScript() {
			const string script = "CREATE PROC Blah AS SELECT FOO; SELECT Bar;";
			var scripts = BatchSqlParser.SplitBatch(script);
			Assert.AreEqual(1, scripts.Length, "Expected no scripts since they would be empty.");
		}