System.Data.SQLite

View Ticket
Login
2016-04-01
00:43
Corrections to the test case for ticket [53633bbe39]. check-in: 67e11dee53 user: mistachkin tags: trunk
00:23
Add tests for ticket [53633bbe39]. check-in: 8b5a097e13 user: mistachkin tags: trunk
2016-03-30
20:47 Ticket [53633bbe39] DetectTextAffinity/DetectStringType bug status still Closed with 3 other changes artifact: 79f4a8e079 user: mistachkin
20:46 Closed ticket [53633bbe39]. artifact: 3514ca7ee7 user: mistachkin
2016-03-22
16:17 Ticket [53633bbe39]: 3 changes artifact: bc7022d358 user: anonymous
15:53 Ticket [53633bbe39]: 3 changes artifact: af2b5c2202 user: anonymous
14:45 Ticket [53633bbe39]: 3 changes artifact: 3ca41608e1 user: mistachkin
13:34 Ticket [53633bbe39]: 3 changes artifact: 289b6c6bee user: mistachkin
08:04 Ticket [53633bbe39]: 3 changes artifact: 4d06f1b1e8 user: anonymous
01:46 Ticket [53633bbe39]: 3 changes artifact: 8319a2630f user: mistachkin
01:39 Ticket [53633bbe39]: 3 changes artifact: cccf799e1b user: anonymous
01:12 Ticket [53633bbe39]: 3 changes artifact: 3c8a687707 user: anonymous
2016-03-21
21:35
Work in progress on the test for ticket [53633bbe39]. Closed-Leaf check-in: 56a4359338 user: mistachkin tags: tkt-53633bbe39
19:15 Ticket [53633bbe39] DetectTextAffinity/DetectStringType bug status still Pending with 3 other changes artifact: a85d7262cb user: mistachkin
19:07 Ticket [53633bbe39]: 3 changes artifact: 8671dd6bed user: mistachkin
18:13 Ticket [53633bbe39]: 3 changes artifact: bdf2886bff user: mistachkin
18:08 Ticket [53633bbe39]: 3 changes artifact: 8d5bfcd279 user: mistachkin
17:41 Ticket [53633bbe39]: 3 changes artifact: 95c0ada60e user: anonymous
17:33 Ticket [53633bbe39]: 3 changes artifact: 0ac18203e7 user: anonymous
17:18 Ticket [53633bbe39]: 3 changes artifact: 8ccf0ce8a2 user: mistachkin
17:17 Ticket [53633bbe39]: 3 changes artifact: 6fe3e05205 user: mistachkin
16:28 Ticket [53633bbe39]: 3 changes artifact: a9a5a0a1ab user: anonymous
16:20 Pending ticket [53633bbe39]. artifact: 298c5da552 user: mistachkin
16:18
Add preliminary test for ticket [53633bbe39]. check-in: a5653a0674 user: mistachkin tags: tkt-53633bbe39
15:30 Ticket [53633bbe39] DetectTextAffinity/DetectStringType bug status still Open with 4 other changes artifact: 8e81a02c4b user: mistachkin
15:29 Ticket [53633bbe39]: 6 changes artifact: e4f7344f78 user: mistachkin
04:19 New ticket [53633bbe39]. artifact: 38a54c266d user: anonymous

Ticket Hash: 53633bbe397e27737c0d9b6175191cd918210366
Title: DetectTextAffinity/DetectStringType bug
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Convert Resolution: Fix_Already_Pending_Release
Last Modified: 2016-03-30 20:47:18
9.16 years ago
Created: 2016-03-21 04:19:58
9.19 years ago
Version Found In: 1.0.99.0
User Comments:
anonymous added on 2016-03-21 04:19:58:
This issue is related to issue 3c00ec5b521b71073b7417d12daddb2c509e5691.

- Using environment vars to set the flags DetectTextAffinity/DetectStringType and DefaultDbType=String;DefaultTypeName=TEXT to generate an EF6 model for an existing database where fields are typeless.
- Model generation will succeed.
- Querying the model will fail if all data in a typeless field is of type Double.

This is due to SQLite3.ColumnAffinity returning TypeAffinity 'Double' for the query statement which SQLiteDataReader.GetSQLiteType/SQLiteDataReader.VerifyType fails to map to the .net string-type on the generated model even though the environment flags are set.


Failing test:
https://dl.dropboxusercontent.com/u/6420016/UnitTestProject1.zip

My environment:
Windows 8 x64
Visual Studio 2015
.NET 4.6
SQLite 1.0.99.0
EntityFramework 6

mistachkin added on 2016-03-21 15:29:30:
Do you have an example schema and query that demonstrates the issue?

mistachkin added on 2016-03-21 16:20:19:
So far, I'm unable to reproduce the issue here.  I've added a preliminary test
case on a branch, here [a5653a06740a80c3].

Any additional information you could provide would be very helpful.

anonymous added on 2016-03-21 16:28:50:
Yes, there is a .sqlite with a table and some sample data in the failing test solution I created for you.
https://dl.dropboxusercontent.com/u/6420016/UnitTestProject1.zip

Here is the schema and sample data if you want it separately
http://pastebin.com/mGjjrDi6

Failing test
http://pastebin.com/rz7JYybk

mistachkin added on 2016-03-21 17:17:41:
Thanks, sorry I didn't notice the DropBox URL before.

In the unit test project, where do you set the environment variables and
connection flags?

mistachkin added on 2016-03-21 17:18:53:
Also related to [dbd65441a5].

anonymous added on 2016-03-21 17:33:07:
They are set as environment vars in windows.

I set them on the connection string using the advanced settings for the data connection in VS but it did not seem to work when generating the edmx model.

Also tried setting them as appSettings in app.config but test still fails.

anonymous added on 2016-03-21 17:41:17:
Noticed in testing that the schema can be as simple as this
CREATE TABLE "a" ("x"  NOT NULL  DEFAULT (-1) )
INSERT INTO "a" VALUES(1);

Value can be any value type that is not implicitly convertible to string.

mistachkin added on 2016-03-21 18:08:58:
Since SQLiteDataReader.GetString is being called from within the EntityFramework
itself, it would appear the best solution would be to use trunk (or 1.0.100.0
when it comes out) and the new NoVerifyTextAffinity connection flag.

mistachkin added on 2016-03-21 18:13:33:
It should also be noted that your test project seemingly fails in the exact same
way whether or not the environment variables are set.

Using the new NoVerifyTextAffinity connection flag might really be the best
option.  I'm going to try it locally.

mistachkin added on 2016-03-21 19:07:19:
Confirmed, the new NoVerifyTextAffinity flag (on trunk) makes it work.  Using
the following before "using (var db = new testEntities())" in the test project
causes the test to pass:

Environment.SetEnvironmentVariable("DefaultFlags_SQLiteConnection",
    "DetectTextAffinity, DetectStringType, NoVerifyTextAffinity");

Environment.SetEnvironmentVariable("Use_SQLiteConvert_DefaultDbType",
    "String");

Environment.SetEnvironmentVariable("Use_SQLiteConvert_DefaultTypeName",
    "TEXT");

anonymous added on 2016-03-22 01:12:44:
Seems to work now, thanks!

Having trouble building 1.0.100.0 and end up getting this error every time I run the application (an assert pops up):
http://i.imgur.com/j00AaMo.png

Are there any nightly builds available? If not; any idea what the problem with my local build is?

I'm building from trunk using SQLite.NET.2015.sln in Debug/Mixed configuration.

anonymous added on 2016-03-22 01:39:59:
Same problem when building in ReleaseNativeOnly, Win32/x64 per the wiki FAQ.

mistachkin added on 2016-03-22 01:46:17:
Is it possible that it's picking up an outdated "SQLite.Interop.dll" along the PATH?

Alternatively, is it possible that it's picking up one that is not the Debug
build configuration (i.e. by default, the INTEROP_LOG feature is only enabled
for debug builds)?

anonymous added on 2016-03-22 08:04:12:
I have verified that it is picking up the correct dlls from my project with Process Explorer.

How would you normally build it using the batch scripts in setup?

mistachkin added on 2016-03-22 13:34:37:
First:

build.bat DebugManagedOnly

Then, for 32-bit Windows:

build.bat DebugNativeOnly Win32

-OR- For 64-bit Windows:

build.bat DebugNativeOnly x64

mistachkin added on 2016-03-22 14:45:21:
How are you building the project?  I'm trying to figure out how you compiled a
debug build without the INTEROP_LOG feature (and hence export) being available.

anonymous added on 2016-03-22 15:53:32:
My process was as follows:
- Download trunk
- Open SQLite.NET.2015.sln
- Switch configuration target to ReleaseNativeOnly and Win32/x64 respectively.
- Build the solution in Visual Studio
- Pick out the built assemblies using paths from .nuspec-files:
  ..\bin\2015\Release\bin\System.Data.SQLite.dll
  ..\bin\2015\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll
  ..\bin\2015\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll
  ..\bin\2015\Release\bin\System.Data.SQLite.EF6.dll
  ..\bin\2015\Release\bin\System.Data.SQLite.Linq.dll

Will try the procedure you posted for building using the bat-files.

anonymous added on 2016-03-22 16:17:25:
Get the same error when building using the bat files. Verified that the correct dlls are loaded.

You don't happen to have a built version from trunk that I can try? .NET 4.6 32-bit windows