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

Serialization & deserialization of numbers fails on clients using Culture with non-standard number formatting #81

Closed
ikudjoi opened this issue Oct 17, 2018 · 3 comments
Milestone

Comments

@ikudjoi
Copy link
Contributor

ikudjoi commented Oct 17, 2018

Issue description

  1. Set your region to e.g. Finland. (On windows region & language settings). Comma will replace the dot as decimal separator.
  2. Execute test SFDbDataReaderIT.testGetFloat.
  3. Executing the test fails. Writing and reading decimal numbers should be possible on any locale.

Example code

Provided already in the test.

Error log

Failed   testGetFloat
Error Message:
 Snowflake.Data.Client.SnowflakeDbException : SQL compilation error:
Invalid bind value (1,23) for type (REAL).
Stack Trace:
   at Snowflake.Data.Core.SFStatement.BuildResultSet(QueryExecResponse response, CancellationToken cancellationToken) in C:\work\snowflake-connector-net\Snowflake.Data\Core\SFStatement.cs:line 121
   at Snowflake.Data.Core.SFStatement.Execute(Int32 timeout, String sql, Dictionary`2 bindings, Boolean describeOnly) in C:\work\snowflake-connector-net\Snowflake.Data\Core\SFStatement.cs:line 233
   at Snowflake.Data.Client.SnowflakeDbCommand.ExecuteInternal(Boolean describeOnly) in C:\work\snowflake-connector-net\Snowflake.Data\Client\SnowflakeDbCommand.cs:line 256
   at Snowflake.Data.Client.SnowflakeDbCommand.ExecuteNonQuery() in C:\work\snowflake-connector-net\Snowflake.Data\Client\SnowflakeDbCommand.cs:line 132
   at Snowflake.Data.Tests.SFDbDataReaderIT.testGetFloat() in C:\work\snowflake-connector-net\Snowflake.Data.Tests\SFDbDataReaderIT.cs:line 118

Configuration

1.0.4

Dotnet framework and version:
.net standard 2.0

Server version:
3.0.5

Client OS:
Windows 10

@ArtturiSipila
Copy link

Just encountered the issue myself, hope the the pull request gets accepted soon!

ikudjoi pushed a commit to ikudjoi/snowflake-connector-net that referenced this issue Oct 23, 2018
ikudjoi pushed a commit to ikudjoi/snowflake-connector-net that referenced this issue Oct 24, 2018
@howryu howryu added this to the v1.0.5 milestone Oct 29, 2018
@howryu
Copy link
Contributor

howryu commented Oct 29, 2018

Merged in #87

@howryu howryu closed this as completed Oct 29, 2018
@marwesfur
Copy link

@howryu In bf2bb58 setting the Thread.CurrentThread.CurrentCulture was moved to the SFDataConverter ctor. Now, it doesn't work in a multi threaded environment anymore, where it might happen that instantiation of SFDataConverter and actual conversion take place in different threads.

I had to switch to the non-async methods to make it work.

Also: Is overwriting Thread.CurrentThread.CurrentCulture a good idea in the first place? Would it be possible to pass the InvariantCulture directly as a parameter to the convert function?

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

No branches or pull requests

4 participants