23 using System.Collections.Generic;
30 namespace Ntp.Analyzer.Config.Syntax
46 var database = Nodes.SingleOrDefault(n => n.Symbol ==
Symbol.KeywordName) as StringSettingNode ??
47 Nodes.SingleOrDefault(n => n.Symbol ==
Symbol.KeywordDatabase) as StringSettingNode;
48 var user = Nodes.SingleOrDefault(n => n.Symbol ==
Symbol.KeywordUser) as StringSettingNode ??
49 Nodes.SingleOrDefault(n => n.Symbol ==
Symbol.KeywordDatabaseUser) as StringSettingNode;
50 var pass = Nodes.SingleOrDefault(n => n.Symbol ==
Symbol.KeywordPass) as StringSettingNode ??
51 Nodes.SingleOrDefault(n => n.Symbol ==
Symbol.KeywordDatabasePass) as StringSettingNode;
53 var upgrade = Nodes.SingleOrDefault(n => n.Symbol ==
Symbol.KeywordUpgrade) as BooleanSettingNode;
54 var
import = Nodes.SingleOrDefault(n => n.Symbol ==
Symbol.KeywordImport) as BooleanSettingNode;
56 var conString = Nodes.SingleOrDefault(n => n.Symbol ==
Symbol.KeywordConString) as StringSettingNode;
57 var certFile = Nodes.SingleOrDefault(n => n.Symbol ==
Symbol.KeywordCertFile) as StringSettingNode;
58 var certPass = Nodes.SingleOrDefault(n => n.Symbol ==
Symbol.KeywordCertPass) as StringSettingNode;
59 var timeout = Nodes.SingleOrDefault(n => n.Symbol ==
Symbol.KeywordConnectionTimeout) as IntegerSettingNode;
60 var protocol = Nodes.SingleOrDefault(n => n.Symbol ==
Symbol.KeywordProtocol) as IntegerSettingNode;
61 var ssl = Nodes.SingleOrDefault(n => n.Symbol ==
Symbol.KeywordEnableSsl) as BooleanSettingNode;
63 if (provider == null || host == null || database == null || user == null || pass == null)
65 throw new InvalidOperationException(
@"Internal compiler error: DatabaseSyntaxNode");
70 provider.DatabaseProvider,
90 CheckIsUnique(
new List<Symbol>
92 Symbol.KeywordDatabaseProvider,
104 Symbol.KeywordDatabaseName,
105 Symbol.KeywordDatabaseUser,
106 Symbol.KeywordDatabasePass,
110 Symbol.KeywordConnectionTimeout,
116 CheckAllIsPresent(
new List<Symbol> {
Symbol.KeywordDatabaseProvider});
118 CheckOneIsPresent(
new List<Symbol>
126 CheckOneIsPresent(
new List<Symbol>
129 Symbol.KeywordDatabaseName
132 CheckOneIsPresent(
new List<Symbol>
135 Symbol.KeywordDatabaseUser
138 CheckOneIsPresent(
new List<Symbol>
141 Symbol.KeywordDatabasePass
147 CheckTypeIs<DatabaseProviderNode>(
Symbol.KeywordDatabaseProvider);
148 CheckTypeIs<StringSettingNode>(
Symbol.KeywordName);
149 CheckTypeIs<StringSettingNode>(
Symbol.KeywordIp);
150 CheckTypeIs<StringSettingNode>(
Symbol.KeywordHost);
151 CheckTypeIs<StringSettingNode>(
Symbol.KeywordAddress);
152 CheckTypeIs<StringSettingNode>(
Symbol.KeywordHostAddress);
153 CheckTypeIs<IntegerSettingNode>(
Symbol.KeywordPort);
154 CheckTypeIs<StringSettingNode>(
Symbol.KeywordUser);
155 CheckTypeIs<StringSettingNode>(
Symbol.KeywordPass);
156 CheckTypeIs<BooleanSettingNode>(
Symbol.KeywordCreate);
157 CheckTypeIs<BooleanSettingNode>(
Symbol.KeywordUpgrade);
158 CheckTypeIs<StringSettingNode>(
Symbol.KeywordConString);
159 CheckTypeIs<StringSettingNode>(
Symbol.KeywordCertFile);
160 CheckTypeIs<StringSettingNode>(
Symbol.KeywordCertPass);
161 CheckTypeIs<IntegerSettingNode>(
Symbol.KeywordConnectionTimeout);
162 CheckTypeIs<IntegerSettingNode>(
Symbol.KeywordProtocol);
163 CheckTypeIs<BooleanSettingNode>(
Symbol.KeywordEnableSsl);
override void ValidateTypes()
Override to validates the types in this syntax node.
DatabaseSyntaxNode(string name, int line)
override DatabaseConfiguration InternalCompile()
override void ValidateMandatories()
Override to validates the mandatory types in this syntax node.