Repository navigation
Expand file tree
/
Copy pathSQLScript.cs
More file actions
72 lines (62 loc) · 2.21 KB
/
Copy pathSQLScript.cs
File metadata and controls
72 lines (62 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
namespace OpenDBDiff.Abstractions.Schema
{
public class SQLScript : IComparable<SQLScript>
{
public SQLScript(int deepvalue, string sqlScript, int dependenciesCount, ScriptAction action)
{
SQL = sqlScript;
Dependencies = dependenciesCount;
Status = action;
Deep = deepvalue;
//childs = new SQLScriptList();
}
public SQLScript(string sqlScript, int dependenciesCount, ScriptAction action)
{
SQL = sqlScript;
Dependencies = dependenciesCount;
Status = action;
//childs = new SQLScriptList();
}
/*public SQLScriptList Childs
{
get { return childs; }
set { childs = value; }
}*/
public int Deep { get; set; }
public ScriptAction Status { get; set; }
public int Dependencies { get; set; }
public string SQL { get; set; }
public bool IsDropAction
{
get
{
return ((Status == ScriptAction.DropView) || (Status == ScriptAction.DropFunction) || (Status == ScriptAction.DropStoredProcedure));
}
}
public bool IsAddAction
{
get
{
return ((Status == ScriptAction.AddView) || (Status == ScriptAction.AddFunction) || (Status == ScriptAction.AddStoredProcedure));
}
}
public int CompareTo(SQLScript other)
{
if (this.Deep == other.Deep)
{
if (this.Status == other.Status)
{
if (this.Status == ScriptAction.DropTable || this.Status == ScriptAction.DropConstraint || this.Status == ScriptAction.DropTrigger)
return other.Dependencies.CompareTo(this.Dependencies);
else
return this.Dependencies.CompareTo(other.Dependencies);
}
else
return this.Status.CompareTo(other.Status);
}
else
return this.Deep.CompareTo(other.Deep);
}
}
}