Skip to content

Code-generate schema collections #1190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ dotnet_diagnostic.SA1503.severity = none # Braces should not be omitted.
dotnet_diagnostic.SA1513.severity = none # Closing brace should be followed by blank line.
dotnet_diagnostic.SA1516.severity = none # Elements should be separated by blank line.
dotnet_diagnostic.SA1600.severity = none # Elements should be documented.
dotnet_diagnostic.SA1601.severity = none # Partial elements should be documented.
dotnet_diagnostic.SA1602.severity = none # Enumeration items should be documented.
dotnet_diagnostic.SA1611.severity = none # Element parameters should be documented.
dotnet_diagnostic.SA1615.severity = none # Element return value should be documented.
Expand Down
15 changes: 13 additions & 2 deletions MySqlConnector.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2010
# Visual Studio Version 17
VisualStudioVersion = 17.3.32611.2
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MySqlConnector", "src\MySqlConnector\MySqlConnector.csproj", "{F82378AF-274E-4FBA-8E45-27126D607B85}"
EndProject
Expand All @@ -20,6 +20,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MySqlConnector.Logging.NLog
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MySqlConnector.Authentication.Ed25519", "src\MySqlConnector.Authentication.Ed25519\MySqlConnector.Authentication.Ed25519.csproj", "{5DB4FA2E-910B-47CE-B467-F6852104D567}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{D0EDA522-FB29-4C44-B4EC-0D3AF72C016D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SchemaCollectionGenerator", "tools\SchemaCollectionGenerator\SchemaCollectionGenerator.csproj", "{2C8FA08E-755D-454D-B98E-10A122673ABE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -62,10 +66,17 @@ Global
{5DB4FA2E-910B-47CE-B467-F6852104D567}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DB4FA2E-910B-47CE-B467-F6852104D567}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DB4FA2E-910B-47CE-B467-F6852104D567}.Release|Any CPU.Build.0 = Release|Any CPU
{2C8FA08E-755D-454D-B98E-10A122673ABE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C8FA08E-755D-454D-B98E-10A122673ABE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C8FA08E-755D-454D-B98E-10A122673ABE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C8FA08E-755D-454D-B98E-10A122673ABE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{2C8FA08E-755D-454D-B98E-10A122673ABE} = {D0EDA522-FB29-4C44-B4EC-0D3AF72C016D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4784EA55-5DE0-404F-8BEC-E14C202F01FA}
EndGlobalSection
Expand Down
17 changes: 9 additions & 8 deletions docs/content/overview/schema-collections.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
date: 2021-04-24
lastmod: 2022-08-12
menu:
main:
parent: getting started
Expand All @@ -14,32 +15,32 @@ weight: 80

`MySqlConnection.GetSchema` supports the following schemas:

* `MetaDataCollections`—information about available schemas
* `MetaDataCollections`—[information about available schemas](../schema/metadatacollections/)
* `CharacterSets`
* `Collations`
* `CollationCharacterSetApplicability`
* `Columns`
* `Columns`—[information about columns (in all tables)](../schema/columns/)
* `Databases`
* `DataTypes`—information about available data types
* `DataSourceInformation`
* `DataTypes`—[information about available data types](../schema/datatypes/)
* `Engines`
* `KeyColumnUsage`
* `KeyWords`
* `Parameters`
* `Partitions`
* `Plugins`
* `Procedures`—information about stored procedures
* `Procedures`—[information about stored procedures](../schema/procedures/)
* `ProcessList`
* `Profiling`
* `ReferentialConstraints`
* `ReservedWords`—information about reserved words in the server's SQL syntax
* `ReservedWords`—[information about reserved words in the server's SQL syntax](../schema/reservedwords/)
* `ResourceGroups`
* `Restrictions`—[information about the restrictions supported when retrieving schemas](../schema/restrictions/)
* `SchemaPrivileges`
* `Tables`
* `Tables`—[information about tables](../schema/tables/)
* `TableConstraints`
* `TablePrivileges`
* `TableSpaces`
* `Triggers`
* `UserPrivileges`
* `Views`

The `GetSchema(string, string[])` overload that specifies restrictions is not supported.
43 changes: 43 additions & 0 deletions docs/content/overview/schema/columns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
date: 2022-07-10
lastmod: 2022-07-11
title: Columns Schema
---

# Columns Schema

The `Columns` schema provides information about columns (in all tables).

Column Name | Data Type | Description
--- | --- | ---
TABLE_CATALOG | string |
TABLE_SCHEMA | string |
TABLE_NAME | string |
COLUMN_NAME | string |
ORDINAL_POSITION | uint |
COLUMN_DEFAULT | string |
IS_NULLABLE | string |
DATA_TYPE | string |
CHARACTER_MAXIMUM_LENGTH | long |
NUMERIC_PRECISION | ulong |
NUMERIC_SCALE | ulong |
DATETIME_PRECISION | uint |
CHARACTER_SET_NAME | string |
COLLATION_NAME | string |
COLUMN_TYPE | string |
COLUMN_KEY | string |
EXTRA | string |
PRIVILEGES | string |
COLUMN_COMMENT | string |
GENERATION_EXPRESSION | string |
SRS_ID | string |

The following restrictions are supported:

Restriction Name | Restriction Default | Restriction Number
--- | --- | --:
Catalog | TABLE_CATALOG | 1
Schema | TABLE_SCHEMA | 2
Table | TABLE_NAME | 3
Column | COLUMN_NAME | 4

36 changes: 36 additions & 0 deletions docs/content/overview/schema/datatypes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
date: 2022-07-10
lastmod: 2022-07-11
title: DataTypes Schema
---

# DataTypes Schema

The `DataTypes` schema provides information about available data types.

Column Name | Data Type | Description
--- | --- | ---
TypeName | string |
ProviderDbType | int |
ColumnSize | long |
CreateFormat | string |
CreateParameters | string |
DataType | string |
IsAutoIncrementable | bool |
IsBestMatch | bool |
IsCaseSensitive | bool |
IsFixedLength | bool |
IsFixedPrecisionScale | bool |
IsLong | bool |
IsNullable | bool |
IsSearchable | bool |
IsSearchableWithLike | bool |
IsUnsigned | bool |
MaximumScale | short |
MinimumScale | short |
IsConcurrencyType | bool |
IsLiteralSupported | bool |
LiteralPrefix | string |
LiteralSuffix | string |
NativeDataType | string |

16 changes: 16 additions & 0 deletions docs/content/overview/schema/metadatacollections.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
date: 2022-07-10
lastmod: 2022-07-11
title: MetaDataCollections Schema
---

# MetaDataCollections Schema

The `MetaDataCollections` schema provides information about available schemas.

Column Name | Data Type | Description
--- | --- | ---
CollectionName | string | The name of the collection to pass to the GetSchema method to return the collection.
NumberOfRestrictions | int | The number of restrictions that may be specified for the collection.
NumberOfIdentifierParts | int | The number of parts in the composite identifier/database object name.

33 changes: 33 additions & 0 deletions docs/content/overview/schema/procedures.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
date: 2022-07-10
lastmod: 2022-07-11
title: Procedures Schema
---

# Procedures Schema

The `Procedures` schema provides information about stored procedures.

Column Name | Data Type | Description
--- | --- | ---
SPECIFIC_NAME | string |
ROUTINE_CATALOG | string |
ROUTINE_SCHEMA | string |
ROUTINE_NAME | string |
ROUTINE_TYPE | string |
DTD_IDENTIFIER | string |
ROUTINE_BODY | string |
ROUTINE_DEFINITION | string |
EXTERNAL_NAME | string |
EXTERNAL_LANGUAGE | string |
PARAMETER_STYLE | string |
IS_DETERMINISTIC | string |
SQL_DATA_ACCESS | string |
SQL_PATH | string |
SECURITY_TYPE | string |
CREATED | DateTime |
LAST_ALTERED | DateTime |
SQL_MODE | string |
ROUTINE_COMMENT | string |
DEFINER | string |

14 changes: 14 additions & 0 deletions docs/content/overview/schema/reservedwords.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
date: 2022-07-10
lastmod: 2022-07-11
title: ReservedWords Schema
---

# ReservedWords Schema

The `ReservedWords` schema provides information about reserved words in the server's SQL syntax.

Column Name | Data Type | Description
--- | --- | ---
ReservedWord | string |

17 changes: 17 additions & 0 deletions docs/content/overview/schema/restrictions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
date: 2022-07-10
lastmod: 2022-07-11
title: Restrictions Schema
---

# Restrictions Schema

The `Restrictions` schema provides information about the restrictions supported when retrieving schemas.

Column Name | Data Type | Description
--- | --- | ---
CollectionName | string | The name of the collection that these restrictions apply to.
RestrictionName | string | The name of the restriction in the collection.
RestrictionDefault | string | Ignored.
RestrictionNumber | int | The actual location in the collections restrictions that this particular restriction falls in.

43 changes: 43 additions & 0 deletions docs/content/overview/schema/tables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
date: 2022-07-10
lastmod: 2022-08-12
title: Tables Schema
---

# Tables Schema

The `Tables` schema provides information about tables.

Column Name | Data Type | Description
--- | --- | ---
TABLE_CATALOG | string |
TABLE_SCHEMA | string |
TABLE_NAME | string |
TABLE_TYPE | string |
ENGINE | string |
VERSION | string |
ROW_FORMAT | string |
TABLE_ROWS | long |
AVG_ROW_LENGTH | long |
DATA_LENGTH | long |
MAX_DATA_LENGTH | long |
INDEX_LENGTH | long |
DATA_FREE | long |
AUTO_INCREMENT | long |
CREATE_TIME | DateTime |
UPDATE_TIME | DateTime |
CHECK_TIME | DateTime |
TABLE_COLLATION | string |
CHECKSUM | string |
CREATE_OPTIONS | string |
TABLE_COMMENT | string |

The following restrictions are supported:

Restriction Name | Restriction Default | Restriction Number
--- | --- | --:
Catalog | TABLE_CATALOG | 1
Schema | TABLE_SCHEMA | 2
Table | TABLE_NAME | 3
TableType | TABLE_TYPE | 4

Loading