Represents a database object with a specific type on a specific database server, database, and schema.
Inheritance: DatabaseObject
Esempio n. 1
0
 /// <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;
     }
 }
Esempio n. 2
0
 /// <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;
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Instantiates a build script object in the given error state.
 /// </summary>
 /// <remarks>
 /// The instance created by this constructor represents a build script that was determined
 /// to be invalid even before the script content was parsed.  This usually happens when the
 /// script repository encounters a problem.
 /// </remarks>
 /// <param name="scriptObject">The identifier of the database object.</param>
 /// <param name="error">The error that was encountered for this script.</param>
 public ScriptFile(DatabaseObject scriptObject, BuildErrorBase error)
 {
     if (scriptObject is TypedDatabaseObject)
     {
         ScriptObject = (TypedDatabaseObject)scriptObject;
     }
     else
     {
         ScriptObject = new TypedDatabaseObject(scriptObject.ServerName, scriptObject.DatabaseName, scriptObject.SchemaName, scriptObject.ObjectName, DatabaseObjectType.Type);
     }
     ScriptError = error;
 }
Esempio n. 4
0
 /// <summary>
 /// Instantiates a build script object in the given error state.
 /// </summary>
 /// <remarks>
 /// The instance created by this constructor represents a build script that was determined 
 /// to be invalid even before the script content was parsed.  This usually happens when the 
 /// script repository encounters a problem.
 /// </remarks>
 /// <param name="scriptObject">The identifier of the database object.</param>
 /// <param name="error">The error that was encountered for this script.</param>
 public ScriptFile(DatabaseObject scriptObject, BuildErrorBase error)
 {
     if (scriptObject is TypedDatabaseObject)
     {
         ScriptObject = (TypedDatabaseObject)scriptObject;
     }
     else
     {
         ScriptObject = new TypedDatabaseObject(scriptObject.ServerName, scriptObject.DatabaseName, scriptObject.SchemaName, scriptObject.ObjectName, DatabaseObjectType.Type);
     }
     ScriptError = error;
 }