-
Notifications
You must be signed in to change notification settings - Fork 4
Add VARCHAR2/NVARCHAR2 type support for Oracle migration compatibility #31
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
base: main
Are you sure you want to change the base?
Add VARCHAR2/NVARCHAR2 type support for Oracle migration compatibility #31
Conversation
- Added VARCHAR2 and NVARCHAR2 to DataTypeNames - Mapped VARCHAR2/NVARCHAR2 to varchar in DataTypeName.FromDisplayName - Added VARCHAR2/NVARCHAR2 to GaussDBDbType mappings - Updated type resolver factories to handle VARCHAR2/NVARCHAR2 - Updated GaussDBParameter size truncation to support VARCHAR2/NVARCHAR2 - Updated GaussDBSchema to treat VARCHAR2/NVARCHAR2 as String types - Added test cases for VARCHAR2 and NVARCHAR2 Co-authored-by: WeihanLi <[email protected]>
|
@copilot add test cases to create a table with VARCHAR2/NVARCHAR2 columns, and verify new data insert/query supports |
- Test creates table with VARCHAR2 and NVARCHAR2 columns - Tests INSERT operations with various string values - Tests SELECT/query operations to read the data - Tests NULL value handling - Includes proper table cleanup Co-authored-by: WeihanLi <[email protected]>
Added comprehensive test case in commit 3ff54a6 that:
|
Updated connection string comment and fixed formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for VARCHAR2 and NVARCHAR2 data types to GaussDB, which are Oracle-compatible variable-length string types. These types are treated similarly to the existing VARCHAR and TEXT types.
- Added new enum values and mappings for VARCHAR2 and NVARCHAR2 types
- Integrated these types into existing text type handling across resolver factories and parameter handling
- Added comprehensive test coverage for table operations with both types
- Updated example code to demonstrate the new types
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/GaussDB/Internal/Postgres/DataTypeNames.cs | Added Varchar2 and Nvarchar2 constant definitions |
| src/GaussDB/GaussDBTypes/GaussDBDbType.cs | Added enum values and conversions for Varchar2 and Nvarchar2 types |
| src/GaussDB/Internal/ResolverFactories/ExtraConversionsTypeInfoResolverFactory.cs | Included Varchar2 and Nvarchar2 in alternative text type iterations |
| src/GaussDB/Internal/ResolverFactories/AdoTypeInfoResolverFactory.cs | Included Varchar2 and Nvarchar2 in alternative text type iterations |
| src/GaussDB/GaussDBSchema.cs | Added Varchar2 and Nvarchar2 to hardcoded data type info population |
| src/GaussDB/GaussDBParameter.cs | Added Varchar2 and Nvarchar2 to size truncation handling logic |
| test/GaussDB.Tests/Types/TextTests.cs | Added comprehensive integration test for Varchar2 and Nvarchar2 operations |
| example/GetStarted/Program.cs | Updated example to demonstrate Varchar2 and Nvarchar2 usage |
| src/GaussDB/GaussDB.csproj | Removed CodeAnalysis package reference |
| Directory.Build.props | Bumped version from 0.1.0 to 0.1.1 |
| .github/workflows/test.yml | Added comment about connection string and set max-parallel to 1 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may still need testing.
GaussDB queries fail on tables with VARCHAR2/NVARCHAR2 columns (Oracle-compatible types) with
InvalidCastException: Reading as 'System.Object' is not supported for fields having DataTypeName 'nvarchar2'.This pull request adds comprehensive support for the
VARCHAR2andNVARCHAR2string types throughout the codebase, including type definitions, type mappings and test coverage. Additionally, there are minor improvements to workflow configuration and example code for better usability and clarity.Fixes 使用dotnet驱动查询含有NVARCHAR2类型字段的表报错 #29
Added test case and example for varchar2/nvarchar2 usage