Skip to content

Commit 292bc55

Browse files
committed
Minor stylistic changes.
1 parent d333690 commit 292bc55

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

DuckDB.NET.Data/DuckDBSchema.cs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@ namespace DuckDB.NET.Data;
88

99
internal static class DuckDBSchema
1010
{
11-
private static readonly string[] TableRestrictions =
12-
["table_catalog", "table_schema", "table_name", "table_type"];
11+
private static readonly string[] TableRestrictions = ["table_catalog", "table_schema", "table_name", "table_type"];
1312

14-
private static readonly string[] ColumnRestrictions =
15-
["table_catalog", "table_schema", "table_name", "column_name"];
13+
private static readonly string[] ColumnRestrictions = ["table_catalog", "table_schema", "table_name", "column_name"];
1614

17-
private static readonly string[] ForeignKeyRestrictions =
18-
["constraint_catalog", "constraint_schema", "table_name", "constraint_name"];
15+
private static readonly string[] ForeignKeyRestrictions = ["constraint_catalog", "constraint_schema", "table_name", "constraint_name"];
1916

20-
private static readonly string[] IndexesRestrictions =
21-
["index_catalog", "index_schema", "table_name", "index_name"];
17+
private static readonly string[] IndexesRestrictions = ["index_catalog", "index_schema", "table_name", "index_name"];
2218

2319
public static DataTable GetSchema(DuckDBConnection connection, string collectionName, string?[]? restrictionValues) =>
2420
collectionName.ToUpperInvariant() switch
@@ -92,14 +88,15 @@ private static DataTable GetReservedWords(DuckDBConnection connection)
9288
{
9389
using var command = connection.CreateCommand();
9490
command.CommandText = "SELECT keyword_name as ReservedWord FROM duckdb_keywords() WHERE keyword_category = 'reserved'";
95-
command.CommandType = CommandType.Text;
9691
return GetDataTable(DbMetaDataCollectionNames.ReservedWords, command);
9792
}
9893

9994
private static DataTable GetTables(DuckDBConnection connection, string?[]? restrictionValues)
10095
{
10196
if (restrictionValues?.Length > TableRestrictions.Length)
97+
{
10298
throw new ArgumentException("Too many restrictions", nameof(restrictionValues));
99+
}
103100

104101
const string query = "SELECT table_catalog, table_schema, table_name, table_type FROM information_schema.tables";
105102

@@ -111,7 +108,9 @@ private static DataTable GetTables(DuckDBConnection connection, string?[]? restr
111108
private static DataTable GetColumns(DuckDBConnection connection, string?[]? restrictionValues)
112109
{
113110
if (restrictionValues?.Length > ColumnRestrictions.Length)
111+
{
114112
throw new ArgumentException("Too many restrictions", nameof(restrictionValues));
113+
}
115114

116115
const string query =
117116
"""
@@ -132,7 +131,9 @@ FROM information_schema.columns
132131
private static DataTable GetForeignKeys(DuckDBConnection connection, string?[]? restrictionValues)
133132
{
134133
if (restrictionValues?.Length > ForeignKeyRestrictions.Length)
134+
{
135135
throw new ArgumentException("Too many restrictions", nameof(restrictionValues));
136+
}
136137

137138
const string query =
138139
"""
@@ -151,7 +152,9 @@ FROM information_schema.table_constraints
151152
private static DataTable GetIndexes(DuckDBConnection connection, string?[]? restrictionValues)
152153
{
153154
if (restrictionValues?.Length > IndexesRestrictions.Length)
155+
{
154156
throw new ArgumentException("Too many restrictions", nameof(restrictionValues));
157+
}
155158

156159
const string query =
157160
"""
@@ -169,8 +172,7 @@ FROM duckdb_indexes()
169172
return GetDataTable(DuckDbMetaDataCollectionNames.Indexes, command);
170173
}
171174

172-
private static DuckDBCommand BuildCommand(DuckDBConnection connection, string query, string?[]? restrictions,
173-
bool addWhere, string[]? restrictionNames)
175+
private static DuckDBCommand BuildCommand(DuckDBConnection connection, string query, string?[]? restrictions, bool addWhere, string[]? restrictionNames)
174176
{
175177
var command = connection.CreateCommand();
176178
if (restrictions is not { Length: > 0 } || restrictionNames == null)

0 commit comments

Comments
 (0)