Skip to content

Commit a24a5ec

Browse files
committed
Oracle sql compiler and translator revised + TagTest fixed for Oracle
1 parent d6c64e2 commit a24a5ec

4 files changed

Lines changed: 235 additions & 211 deletions

File tree

Orm/Xtensive.Orm.Oracle/Sql.Drivers.Oracle/v09/Compiler.cs

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,17 @@ public override void Visit(SqlFunctionCall node)
8282

8383
public override void Visit(SqlCreateTable node)
8484
{
85-
var table = node.Table as TemporaryTable;
86-
if (table!=null && !table.IsGlobal)
85+
if (node.Table is TemporaryTable table && !table.IsGlobal) {
8786
throw new NotSupportedException(Strings.ExOracleDoesNotSupportLocalTemporaryTables);
87+
}
8888
base.Visit(node);
8989
}
9090

9191
public override void Visit(SqlTrim node)
9292
{
93-
if (node.TrimCharacters!=null && node.TrimCharacters.Length > 1)
93+
if (node.TrimCharacters != null && node.TrimCharacters.Length > 1) {
9494
throw new NotSupportedException(Strings.ExOracleDoesNotSupportTrimmingMoreThatOneCharacterAtOnce);
95+
}
9596
base.Visit(node);
9697
}
9798

@@ -165,50 +166,54 @@ public override void Visit(SqlExtract node)
165166

166167
public override void VisitSelectFrom(SqlSelect node)
167168
{
168-
if (node.From!=null)
169+
if (node.From != null) {
169170
base.VisitSelectFrom(node);
170-
else
171-
context.Output.Append("FROM DUAL");
171+
}
172+
else {
173+
_ = context.Output.Append("FROM DUAL");
174+
}
172175
}
173176

174177
public override void Visit(SqlJoinHint node)
175178
{
176179
var method = translator.Translate(node.Method);
177-
if (string.IsNullOrEmpty(method))
180+
if (string.IsNullOrEmpty(method)) {
178181
return;
179-
context.Output.Append(method);
180-
context.Output.Append("(");
182+
}
183+
184+
_ = context.Output.Append(method);
185+
_ = context.Output.AppendOpeningPunctuation("(");
181186
node.Table.AcceptVisitor(this);
182-
context.Output.Append(")");
187+
_ = context.Output.AppendClosingPunctuation(")");
183188
}
184189

185-
public override void Visit(SqlFastFirstRowsHint node)
186-
{
190+
public override void Visit(SqlFastFirstRowsHint node) =>
187191
context.Output.Append(string.Format("FIRST_ROWS({0})", node.Amount));
188-
}
189192

190-
public override void Visit(SqlNativeHint node)
191-
{
192-
context.Output.Append(node.HintText);
193-
}
193+
public override void Visit(SqlNativeHint node) => context.Output.Append(node.HintText);
194+
194195

195196
public override void Visit(SqlForceJoinOrderHint node)
196197
{
197-
if (node.Tables.IsNullOrEmpty())
198-
context.Output.Append("ORDERED");
198+
if (node.Tables.IsNullOrEmpty()) {
199+
_ = context.Output.Append("ORDERED");
200+
}
199201
else {
200-
context.Output.Append("LEADING(");
201-
using (context.EnterCollectionScope())
202-
foreach (var table in node.Tables)
202+
_ = context.Output.AppendOpeningPunctuation("LEADING(");
203+
using (context.EnterCollectionScope()) {
204+
foreach (var table in node.Tables) {
203205
table.AcceptVisitor(this);
204-
context.Output.Append(")");
206+
}
207+
}
208+
_ = context.Output.AppendClosingPunctuation(")");
205209
}
206210
}
207211

208212
public override void Visit(SqlUpdate node)
209213
{
210-
if (node.From!=null)
214+
if (node.From != null) {
211215
throw new NotSupportedException(Strings.ExOracleDoesNotSupportUpdateFromStatements);
216+
}
212217
base.Visit(node);
213218
}
214219

0 commit comments

Comments
 (0)