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

Char mapping #1279

Closed
RoyC-Retail-Assist opened this issue Aug 13, 2018 · 2 comments
Closed

Char mapping #1279

RoyC-Retail-Assist opened this issue Aug 13, 2018 · 2 comments
Assignees
Labels
provider: sqlite status: has-pr There is active PR for issue
Milestone

Comments

@RoyC-Retail-Assist
Copy link
Contributor

	[TestFixture]
	public class CharValueTests : TestBase
	{
		class Table1
		{
			[PrimaryKey(1)]
			[Identity] public int Id { get; set; }

			public Char CharFld { get; set; }
		}

		[Test, DataContextSource(false)]
		public void Test(string context)
		{
			using (var db = new TestDataConnection())
			{
				db.DropTable<Table1>(throwExceptionIfNotExists: false);
				db.CreateTable<Table1>();

				var val = 'P';

				db.Insert(new Table1 { CharFld = val });

				var result = db.GetTable<Table1>().First().CharFld;

				Assert.AreEqual(val, result);

				db.DropTable<Table1>(throwExceptionIfNotExists: false);
			}
		}
	}

When run for SQLite.MS result is 56 ('8') not 80 ('P'). I've tested other values and it looks like the return value is the first digit of the value of the char rather than the char itself e.g. for 'z' 122 the result is '1', for char.MinValue 0 '\0' the result is 48 '0'

SQLite.Classic works fine so it would suggest that this is something that the underlying DataConnection is returning differently.

I'm getting the same problem with the DB2 iSeries provider (which is what prompted me to do further investigation) so this not confined to SQLite.MS.

Environment details

linq2db version: 2.2.0
Database Server: N/A
Database Provider: SQLite.MS, DB2 iSeries and possibly others
Operating system: Windows 10
Framework version: .NET Framework 4.6.2

@MaceWindu MaceWindu self-assigned this Aug 20, 2018
@MaceWindu MaceWindu added this to the 2.3.0 milestone Aug 20, 2018
@MaceWindu MaceWindu added the status: has-pr There is active PR for issue label Aug 27, 2018
@MaceWindu
Copy link
Contributor

@RoyC-Retail-Assist It was sqlite.ms provider issue which is fixed. For iSeries you need to check if it has similar behavior and decide how it fix it.

@RoyC-Retail-Assist
Copy link
Contributor Author

@MaceWindu thank you. I'll apply the same fix to the iSeries provider and work from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
provider: sqlite status: has-pr There is active PR for issue
Development

No branches or pull requests

2 participants