Navigation Menu

Skip to content
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

[Firebird] Guid literal generation (ValueToSqlConverter) #2833

Closed
jack128 opened this issue Feb 11, 2021 · 4 comments
Closed

[Firebird] Guid literal generation (ValueToSqlConverter) #2833

jack128 opened this issue Feb 11, 2021 · 4 comments

Comments

@jack128
Copy link
Contributor

jack128 commented Feb 11, 2021

Current behavior:

db.InlineParameters = true;
var guid = Guid.NewGuid(); 
db.MyTable.Insert(() => new MyTable { GuidValue = guid });

will generate

INSERT INTO MyTable
(
	GuidValue
)
VALUES
(
	'b999f87c-fcc0-4858-b155-264205d8c36a'
)

It would be nice to generate native format, something like

INSERT INTO MyTable
(
	GuidValue
)
VALUES
(
	X'48DE4C2A3FFF422DABB48357FF84E27F'
)

but it's breaking change!
Is it OK to add flag to FirebirdConfiguration ??

/// <summary>
/// Specifies how linq2db stored Guids. If true then GUIDs enforced stored as strings
/// </summary>
public static bool IsGuidEncodedAsString { get; set; } = true;

IsGuidEncodedAsString = true means old behavior,

IsGuidEncodedAsString DataType Result SQL value
true any 'b999f87c-fcc0-4858-b155-264205d8c36a'
false Guid X'48DE4C2A3FFF422DABB48357FF84E27F'
false != Guid 'b999f87c-fcc0-4858-b155-264205d8c36a'
@MaceWindu
Copy link
Contributor

I don't want to introduce new flags. We should switch to native format and provide guidelines how to re-configure mapping schema to use old format.
As it is breaking change and user could easly reconfigure mapping schema to use native format I propose to include it into v4 release alongside with big refactoring I'm planning for Firebird provider to support v3 and v4 features: #2693

@jack128
Copy link
Contributor Author

jack128 commented Feb 11, 2021

Well, this issue and #2823 are bonded. Fixing one without other is useless, IMHO. Should I close #2826 and make PK to features/firebird_refactoring ?

@MaceWindu
Copy link
Contributor

No need to close, I'll just change pr target

@MaceWindu
Copy link
Contributor

#2826

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants