本文整理汇总了C#中IParser.ParseSqlScript方法的典型用法代码示例。如果您正苦于以下问题:C# IParser.ParseSqlScript方法的具体用法?C# IParser.ParseSqlScript怎么用?C# IParser.ParseSqlScript使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IParser
的用法示例。
在下文中一共展示了IParser.ParseSqlScript方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ScriptFile
/// <summary>
/// Instantiates a build script object.
/// </summary>
/// <remarks>
/// This constructor will attempt to parse the given SQL and determine whether it is valid
/// and whether the script creates the object specified by the given identifier. If the
/// script is invalid in anyway, the <see cref="ScriptError"/> property will reflect that.
/// </remarks>
/// <param name="scriptObject">The identifier of the database object to build.</param>
/// <param name="scriptContent">The build script SQL content.</param>
/// <param name="parser">The sql script parser for reading the SQL script content.</param>
public ScriptFile(TypedDatabaseObject scriptObject, string scriptContent, IParser parser)
{
ScriptObject = scriptObject;
Content = scriptContent;
existingDependencies = new HashSet<TypedDatabaseObject>();
try
{
Sql = parser.ParseSqlScript(scriptContent);
AssertMatchingContent();
}
catch (SqlParseException ex)
{
ScriptError = new SqlParseError(ex.Message);
Sql = null;
}
catch(EmptyTextException)
{
ScriptError = new EmptyTextError();
Sql = null;
}
catch(MultipleStatementException ex)
{
ScriptError = new MultipleStatementError(ex.Count, ex.Allotment);
Sql = null;
}
catch(UnexpectedObjectTypeException ex)
{
ScriptError = new UnexpectedObjectTypeError(ex.TypeName);
Sql = null;
}
}