- Notifications
You must be signed in to change notification settings - Fork 476
Refactor provider configuration and versioning #4002
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
Conversation
8aceffe to 256d4e2 Compare 256d4e2 to 2f422ee Compare - add provider detector to most of providers
2f422ee to c609db9 Compare - add Firebird 5 support
- refactor provider adapters - mapping schema fixes - mysql/firebird refactorings fixes - enable FB3+ features
| /azp run test-all |
| Azure Pipelines successfully started running 1 pipeline(s). |
| /azp run test-all |
| Azure Pipelines successfully started running 1 pipeline(s). |
| Test baselines changed by this PR. Don't forget to merge/close baselines PR after this pr merged/closed. |
| /azp run test-all |
| Azure Pipelines successfully started running 1 pipeline(s). |
| Test baselines changed by this PR. Don't forget to merge/close baselines PR after this pr merged/closed. |
| Test baselines changed by this PR. Don't forget to merge/close baselines PR after this pr merged/closed. |
| /azp run test-all |
| Azure Pipelines successfully started running 1 pipeline(s). |
| /azp run test-all |
| Azure Pipelines successfully started running 1 pipeline(s). |
| /azp run test-all |
| Azure Pipelines successfully started running 1 pipeline(s). |
| /azp run test-all |
| Azure Pipelines successfully started running 1 pipeline(s). |
| baselines good, except one sqlite test and missing FB features (all fixed) |
| /azp run test-all |
| Azure Pipelines successfully started running 1 pipeline(s). |
* [Windows / SQLite (specialized tests)] baselines * [Windows / SQLite (both providers)] baselines * [Windows / SQL CE] baselines * [Windows / Access MDB (Jet/ODBC)] baselines * [Windows / SQLite (both providers)] baselines * [Windows / SQL Server 2019] baselines * [Windows / SQL Server 2008] baselines * [Windows / SQL Server 2019] baselines * [Linux / Firebird 2.5] baselines * [Windows / SQL Server EXTRAS] baselines * [Windows / SQL Server 2014] baselines * [Windows / SQL Server 2012] baselines * [Windows / SQL Server 2016] baselines * [Linux / DB2 LUW 11.5] baselines * [Windows / SQL Server 2017] baselines * [Linux / Informix 14.10] baselines * [Linux / Firebird 3.0] baselines * [Linux / MariaDB 11] baselines * [Linux / Firebird 5.0] baselines * [Linux / Firebird 4.0] baselines * [Linux / MySQL 8 (both providers)] baselines * [Linux / MySQL 5.7 (both providers)] baselines * [Linux / Oracle 11g XE] baselines * [Linux / PostgreSQL 11] baselines * [Linux / PostgreSQL 12] baselines * [Windows / SQL Server 2022] baselines * [Linux / PostgreSQL 13] baselines * [Linux / PostgreSQL 14] baselines * [Linux / Oracle 12c] baselines * [Linux / Oracle 18c] baselines * [Linux / PostgreSQL 15] baselines * [Linux / PostgreSQL 16] baselines * [Linux / Oracle 19c] baselines * [Linux / Oracle 23c] baselines * [Linux / Oracle 21c] baselines * [Linux / SQLite (specialized tests)] baselines * [Linux / SQLite (both providers)] baselines * [Linux / Sybase ASE 16] baselines * [Linux / SQL Server EXTRAS] baselines * [Linux / SQL Server 2019] baselines * [Linux / SQL Server 2019] baselines * [Linux / SAP HANA 2] baselines * [Windows / SQL Server 2005] baselines * [Windows / SQLite (specialized tests)] baselines * [Windows / SQLite (both providers)] baselines * [Windows / SQL Server 2019] baselines * [Windows / SQLite (specialized tests)] baselines * [Windows / SQLite (both providers)] baselines * [Windows / SQL Server 2019] baselines * [Windows / SQL Server EXTRAS] baselines * [Linux / Firebird 5.0] baselines * [Linux / Firebird 4.0] baselines * [Linux / Oracle 11g XE] baselines * [Linux / SQL Server EXTRAS] baselines * [Linux / SQL Server 2019] baselines * [Linux / SQL Server 2019] baselines --------- Co-authored-by: Azure Pipelines Bot <azp@linq2db.com>
Fixes #1024
Fixes #3154
This PR reviews database providing versioning implementation:
updates API to register database provider in options to use same set of methods for each provider. Old implementation had non-uniform set of registration methods for each database, often even with different names for same database provider. In new implementation each provider will have 4 overloads to register provider (except SQL CE provider, which doesn't have two last methods as it doesn't have versioning):
Use<DB>(optionSetter)Use<DB>(connectionString, optionSetter)Use<DB>(dialect and/or provider, optionSetter = null)Use<DB>(dialect and/or provider, connectionString, optionSetter = )major cleanup of
<DB>Toolsclasses and related code:BulkCopyAPIsProviderDetectorclasses where it wasn't done beforAutoDetectoption property for provider detectorIDataProviderFactory) were updated to support new versioning options like dialect and provider assembly (assemblyName,versionattributes). (I wonder if anyone uses those factories at all)GetDataProviderAPI to accept provider and dialect (where applicable) and connection string parametersCreateDataConnectionAPI to be 3 methods withadded dialect/provider versioning to providers missing it:
AutoDetectvalue as first entry to use provider/dialect detection logic (still we recommend to specify them explicitly to not depend on it if you don't need to work in unknown environment)Access: addAccessProviderprovider selection enumFirebird: addFirebirdVersiondialect selection enumInformix: addInformixProviderprovider selection enumMySql/MariaDB: addMySqlProviderprovider andMySqlVersiondialect selection enumsSQLite: addSQLiteProviderprovider selection enumSAP HANA: addSapHanaProviderprovider selection enumSAP/Sybase ASE: addSybaseProviderprovider selection enumdatabase connection creation logic moved from database provider to database provider adapter interface (
IDynamicProviderAdapter)fixed issue with database dialect detection when options specify connection or transaction but not connection string
simplify struct types registration in mapping schema: now nullable type will be registered automatically when you register struct type, so there is no need to define two same mappings anymore. Apllicable to
AddScalarTypeandSetDataTypemethods.adds dialects support for
Firebird. Instead of old implementation with generated SQL compatible with Firebird 2.5 now we support 4 dialects: 2.5, 3.0, 4.0 and 5.0v3+:boolnow maps toBOOLEANtype by default. To use old mapping to1/0chars, specifyDataType.Chartype hint for your mappings or use 2.5 dialectv3+: switched toOFFSET/FETCHclausesv4+: enabledLATERALjoinsv3+: increased batch size for bulk copy queries from 64Kb as query size to 10Mbv5+: increased supported elements limit inINpredicate from 1 500 to 65 535 itemsv5+: enable support forWHEN NOT MATCHED BY SOURCEmerge operationsv5+: enable support forquarterqualifier forDatePartfunctionsadds dialects support for
MySQL/MariaDB. Instead of old implementation compatible with MySQL 5.5, now we have support for 4 dialects: MySQL 5.7, MySQL 8.0 and MariaDB 10MySQL 8.0/MariaDB: don't useFROM DUALfor table-less queries anymore (still needed forMySQL 5.7table-less queries with filter)MySQL 8.0/MariaDB: enabled support forCASTtoFLOAT/DOUBLEtypesMySQL 8.0: enabledLATERALjoinsMySQL 8.0/MariaDB: enabled native support forEXCEPT/INTERSECT ALL/DISTINCTset operatorsAll: remove generation ofFLOAT(N)type. UseDbTypeproperty in your mappings if you still need it for some reasonenabled
LATERALjoins support for SAP HANAFor developers:
MySql.5.7: MySQL 5.7 usingMySql.DataproviderMySqlConnector.5.7: MySQL 5.7 usingMySqlConnectorproviderMySql.8.0: MySQL 8.0 usingMySql.DataproviderMySqlConnector.8.0: MySQL 8.0 usingMySqlConnectorproviderMariaDB.11: MariaDB 11 usingMySqlConnectorprovider. Note that currently MariaDB 11 doesn't differ from 10 in SQL features, so we don't add separate MariaDB 11 dialect.Firebird.2.5Firebird.3Firebird.4Firebird.5year(2)pre-mysql 5.7 legacy type removed from testingKnown issues (introduced or discovered by PR):
booltocharmapping still configured inFirebirdProvider.SetParametermethod instead ofMappingSchemadue to a lot discovered bugs withDataParameter-based mappings. Will be re-enabled and fixed in new parser branchLATERALjoins were enabled (bad optimizer?). Should be already fixed in new parser branchEXCEPT/INTERSECT ALLset operators emulation for unsupporting databases doesn't handle duplicate records. Will be fixed in new parser/separate PRCROSS APPLYfor Firebird 5 afterLATERALjoins enabled. Should be already fixed in new parser branch