Use better code
This commit is contained in:
parent
608e7a99bc
commit
75c8a8ced4
32 changed files with 77 additions and 105 deletions
|
|
@ -80,7 +80,7 @@ public class MysqlQueryBuilder : GenericQueryBuilder, IQueryBuilder
|
|||
return ret + (length is not null ? "({0})".SFormat((int)length) : "");
|
||||
}
|
||||
|
||||
throw new NotImplementedException(Enum.GetName(typeof(MySqlDbType), type));
|
||||
throw new NotImplementedException(Enum.GetName(type));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class PostgresQueryBuilder : GenericQueryBuilder
|
|||
MySqlDbType.Int64 => "BIGINT",
|
||||
MySqlDbType.DateTime => "TIMESTAMP",
|
||||
|
||||
_ => throw new NotImplementedException(Enum.GetName(typeof(MySqlDbType), type))
|
||||
_ => throw new NotImplementedException(Enum.GetName(type))
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
@ -79,7 +79,7 @@ public class PostgresQueryBuilder : GenericQueryBuilder
|
|||
.Where(c => c.Unique).Select(c => c.Name)
|
||||
.ToArray(); // No re-enumeration
|
||||
|
||||
return $"CREATE TABLE {EscapeTableName(table.Name)} ({string.Join(", ", columns)} {(uniques.Any() ? ", UNIQUE({0})".SFormat(string.Join(", ", uniques)) : "")})";
|
||||
return $"CREATE TABLE {EscapeTableName(table.Name)} ({string.Join(", ", columns)} {(uniques.Length != 0 ? ", UNIQUE({0})".SFormat(string.Join(", ", uniques)) : "")})";
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class SqliteQueryBuilder : GenericQueryBuilder, IQueryBuilder
|
|||
var uniques = table.Columns.Where(c => c.Unique).Select(c => c.Name);
|
||||
return "CREATE TABLE {0} ({1} {2})".SFormat(EscapeTableName(table.Name),
|
||||
string.Join(", ", columns),
|
||||
uniques.Count() > 0 ? ", UNIQUE({0})".SFormat(string.Join(", ", uniques)) : "");
|
||||
uniques.Any() ? ", UNIQUE({0})".SFormat(string.Join(", ", uniques)) : "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -91,7 +91,7 @@ public class SqliteQueryBuilder : GenericQueryBuilder, IQueryBuilder
|
|||
return ret;
|
||||
}
|
||||
|
||||
throw new NotImplementedException(Enum.GetName(typeof(MySqlDbType), type));
|
||||
throw new NotImplementedException(Enum.GetName(type));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue