-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Updating DatabaseLoader to support getting column info from a given .NET type. #4091
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
Changes from all commits
8768848
f3a024f
d785db4
e2d11c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -66,5 +66,82 @@ public static Type ToType(this DbType dbType) | |||||||||||||
return null; | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
/// <summary>Maps a <see cref="InternalDataKind"/> to the associated <see cref="DbType"/>.</summary> | ||||||||||||||
public static DbType ToDbType(this InternalDataKind dataKind) | ||||||||||||||
{ | ||||||||||||||
switch (dataKind) | ||||||||||||||
{ | ||||||||||||||
case InternalDataKind.I1: | ||||||||||||||
{ | ||||||||||||||
return DbType.SByte; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
case InternalDataKind.U1: | ||||||||||||||
{ | ||||||||||||||
return DbType.Byte; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
case InternalDataKind.I2: | ||||||||||||||
{ | ||||||||||||||
return DbType.Int16; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
case InternalDataKind.U2: | ||||||||||||||
{ | ||||||||||||||
return DbType.UInt16; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
case InternalDataKind.I4: | ||||||||||||||
{ | ||||||||||||||
return DbType.Int32; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
case InternalDataKind.U4: | ||||||||||||||
{ | ||||||||||||||
return DbType.UInt32; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
case InternalDataKind.I8: | ||||||||||||||
{ | ||||||||||||||
return DbType.Int64; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
case InternalDataKind.U8: | ||||||||||||||
{ | ||||||||||||||
return DbType.UInt64; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
case InternalDataKind.R4: | ||||||||||||||
{ | ||||||||||||||
return DbType.Single; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
case InternalDataKind.R8: | ||||||||||||||
{ | ||||||||||||||
return DbType.Double; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
case InternalDataKind.TX: | ||||||||||||||
{ | ||||||||||||||
return DbType.String; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
case InternalDataKind.BL: | ||||||||||||||
{ | ||||||||||||||
return DbType.Boolean; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
case InternalDataKind.DT: | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about DateTimeOffset (InternalDataKind.DZ) and TimeSpan (InternalDataKind.TS) ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no equivalent for DbKind There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even https://docs.microsoft.com/en-us/dotnet/api/system.data.dbtype There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The latter is the SQL time type, not an equivalent to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
According to https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-data-type-mappings, it is the appropriate mapping:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that also the appropriate mapping for all database types, not just SQL? Also, it looks like it isn't even the SQL
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, right. |
||||||||||||||
{ | ||||||||||||||
return DbType.DateTime; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
default: | ||||||||||||||
{ | ||||||||||||||
throw new NotSupportedException(); | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
} |
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.
What does "to the end of the line" mean to a database loader?
I think we should remove these options until we decide we have data that says they are required. That way they don't "sneak" in to the product, and don't do anything.
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.
In this case it would mean to the end of the table. I'm pretty sure it is used for vector support.