Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Commit 57c3a8c

Browse files
committed
Fixing code inspection issues.
1 parent fc82963 commit 57c3a8c

File tree

27 files changed

+490
-564
lines changed

27 files changed

+490
-564
lines changed

‎DataCore.Database.MySql/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following

‎DataCore.Database.Oracle/OracleTranslator.cs

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -121,26 +121,26 @@ public override IEnumerable<string> GetCreateTableQuery(string tableName, IEnume
121121
yield return query.ToString();
122122

123123
var identity = fieldList.FirstOrDefault(f => f.IsIdentity);
124-
if (identity != null)
125-
{
126-
var sequenceName = tableName + "_sequence";
127-
var triggerName = tableName + "_on_insert";
128-
129-
yield return string.Concat("CREATE SEQUENCE ", sequenceName);
130-
131-
query.Clear();
132-
query.Append("CREATE OR REPLACE TRIGGER ");
133-
query.Append(triggerName);
134-
query.Append(" BEFORE INSERT ON ");
135-
query.Append(tableName);
136-
query.Append(" FOR EACH ROW BEGIN SELECT ");
137-
query.Append(sequenceName);
138-
query.Append(".nextval INTO :new.");
139-
query.Append(identity.Name);
140-
query.Append(" FROM dual; END;");
141-
142-
yield return query.ToString();
143-
}
124+
if (identity == null)
125+
yield break;
126+
127+
var sequenceName = tableName + "_sequence";
128+
var triggerName = tableName + "_on_insert";
129+
130+
yield return string.Concat("CREATE SEQUENCE ", sequenceName);
131+
132+
query.Clear();
133+
query.Append("CREATE OR REPLACE TRIGGER ");
134+
query.Append(triggerName);
135+
query.Append(" BEFORE INSERT ON ");
136+
query.Append(tableName);
137+
query.Append(" FOR EACH ROW BEGIN SELECT ");
138+
query.Append(sequenceName);
139+
query.Append(".nextval INTO :new.");
140+
query.Append(identity.Name);
141+
query.Append(" FROM dual; END;");
142+
143+
yield return query.ToString();
144144
}
145145

146146
public override IEnumerable<string> GetCreateTableIfNotExistsQuery(string tableName, IEnumerable<FieldDefinition> fields)
@@ -157,26 +157,26 @@ public override IEnumerable<string> GetCreateTableIfNotExistsQuery(string tableN
157157
yield return CatchException(query.ToString(), -955);
158158

159159
var identity = fieldList.FirstOrDefault(f => f.IsIdentity);
160-
if (identity != null)
161-
{
162-
var sequenceName = tableName + "_sequence";
163-
var triggerName = tableName + "_on_insert";
164-
165-
yield return CatchException(string.Concat("CREATE SEQUENCE ", sequenceName));
166-
167-
query.Clear();
168-
query.Append("CREATE OR REPLACE TRIGGER ");
169-
query.Append(triggerName);
170-
query.Append(" BEFORE INSERT ON ");
171-
query.Append(tableName);
172-
query.Append(" FOR EACH ROW BEGIN SELECT ");
173-
query.Append(sequenceName);
174-
query.Append(".nextval INTO :new.");
175-
query.Append(identity.Name);
176-
query.Append(" FROM dual; END;");
177-
178-
yield return CatchException(query.ToString());
179-
}
160+
if (identity == null)
161+
yield break;
162+
163+
var sequenceName = tableName + "_sequence";
164+
var triggerName = tableName + "_on_insert";
165+
166+
yield return CatchException(string.Concat("CREATE SEQUENCE ", sequenceName));
167+
168+
query.Clear();
169+
query.Append("CREATE OR REPLACE TRIGGER ");
170+
query.Append(triggerName);
171+
query.Append(" BEFORE INSERT ON ");
172+
query.Append(tableName);
173+
query.Append(" FOR EACH ROW BEGIN SELECT ");
174+
query.Append(sequenceName);
175+
query.Append(".nextval INTO :new.");
176+
query.Append(identity.Name);
177+
query.Append(" FROM dual; END;");
178+
179+
yield return CatchException(query.ToString());
180180
}
181181

182182
public override string GetCreateColumnQuery(string tableName, FieldDefinition field)
@@ -329,13 +329,13 @@ public override string GetAliasFormat()
329329
return "\"{0}\"";
330330
}
331331

332-
private string CatchException(string sql, int exceptionCode)
332+
private static string CatchException(string sql, int exceptionCode)
333333
{
334334
return string.Concat("BEGIN EXECUTE IMMEDIATE '", sql, "' ; EXCEPTION WHEN OTHERS THEN IF SQLCODE != ",
335335
exceptionCode, " THEN RAISE; END IF; END;");
336336
}
337337

338-
private string CatchException(string sql)
338+
private static string CatchException(string sql)
339339
{
340340
return string.Concat("BEGIN EXECUTE IMMEDIATE '", sql, "' ; EXCEPTION WHEN OTHERS THEN NULL; END;");
341341
}

‎DataCore.Database.Oracle/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following

‎DataCore.Database.Postgres/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following

‎DataCore.Database.SqlServer/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following

‎DataCore.Database.Sqlite/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following

0 commit comments

Comments
 (0)