robertohuertasm / SQLite4Unity3d

SQLite made easy for Unity3d
MIT License
1.28k stars 265 forks source link

Unity 5.3 Windows example scene SQLiteException no such table: Person #33

Closed Naphier closed 8 years ago

Naphier commented 8 years ago

For Windows x86 and x86_64 build this plugin appears to not be working SQLiteException no such table: Person when running scene "ExistingDBScript" Works in the editor just fine. This is under Windows 10 and Unity 5.3.1f1 CreateDBFromScript scene seems to work fine in editor and build. issue

Mono path[0] = 'E:/@Documents/Unity Repos/SQLite4Unity3d/Example_unity5/Build/test2/test2_Data/Managed'
Mono path[1] = 'E:/@Documents/Unity Repos/SQLite4Unity3d/Example_unity5/Build/test2/test2_Data/Mono'
Mono config path = 'E:/@Documents/Unity Repos/SQLite4Unity3d/Example_unity5/Build/test2/test2_Data/Mono/etc'
PlayerConnection initialized from E:/@Documents/Unity Repos/SQLite4Unity3d/Example_unity5/Build/test2/test2_Data (debug = 0)
PlayerConnection initialized network socket : 0.0.0.0 55421
Multi-casting "[IP] 192.168.1.7 [Port] 55421 [Flags] 3 [Guid] 1554696270 [EditorId] 267894875 [Version] 1048832 [Id] WindowsPlayer(Big_Daddy) [Debug] 1" to [225.0.0.222:54997]...
Waiting for connection from host on [192.168.1.7:55421]...
PlayerConnection accepted from [192.168.1.7] handle:0x2c8
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,defer=y,address=0.0.0.0:56270
PlayerConnection already initialized - listening to [192.168.1.7:55421]
Initialize engine version: 5.3.1f1 (cc9cbbcc37b4)
GfxDevice: creating device client; threaded=1
Direct3D:
    Version:  Direct3D 11.0 [level 11.0]
    Renderer: AMD Radeon HD 5800 Series (ID=0x689e)
    Vendor:   ATI
    VRAM:     2023 MB
Begin MonoManager ReloadAssembly
Platform assembly: E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\UnityEngine.dll (this message is harmless)
Loading E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\UnityEngine.dll into Unity Child Domain
Platform assembly: E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\Assembly-CSharp.dll (this message is harmless)
Loading E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\Assembly-CSharp.dll into Unity Child Domain
Platform assembly: E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\UnityEngine.UI.dll (this message is harmless)
Loading E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\UnityEngine.UI.dll into Unity Child Domain
Platform assembly: E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\UnityEngine.Networking.dll (this message is harmless)
Loading E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\UnityEngine.Networking.dll into Unity Child Domain
Platform assembly: E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\SQLite4Unity3d.dll (this message is harmless)
Loading E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\SQLite4Unity3d.dll into Unity Child Domain
Platform assembly: E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\UnityEngine.Networking.dll (this message is harmless)
Loading E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\UnityEngine.Networking.dll into Unity Child Domain
Platform assembly: E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\UnityEngine.UI.dll (this message is harmless)
Loading E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\UnityEngine.UI.dll into Unity Child Domain
- Completed reload, in  0.268 seconds
Platform assembly: E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\System.Core.dll (this message is harmless)
Platform assembly: E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Build\test2\test2_Data\Managed\System.dll (this message is harmless)
desktop: 1920x1080 60Hz; virtual: 3840x1080 at 0,0
<RI> Initializing input.

<RI.Hid> Failed to create device file:
 2 The system cannot find the file specified.

(Filename: C:/buildslave/unity/build/PlatformDependent/Win/RawInput.cpp Line: 54)

<RI> Input initialized.

<RI> Initialized touch support.

UnloadTime: 1.290177 ms
Final PATH: C:/Users/BigDaddy/AppData/LocalLow/DefaultCompany/Example_unity5/existing.db
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
DataService:.ctor(String) (at E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Assets\Scripts\DataService.cs:53)
ExistingDBScript:Start() (at E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Assets\Scripts\ExistingDBScript.cs:11)

(Filename: E:/@Documents/Unity Repos/SQLite4Unity3d/Example_unity5/Assets/Scripts/DataService.cs Line: 53)

SQLiteException: no such table: Person
  at SQLite4Unity3d.SQLite3.Prepare2 (IntPtr db, System.String query) [0x00000] in <filename unknown>:0 
  at SQLite4Unity3d.SQLiteCommand.Prepare () [0x00000] in <filename unknown>:0 
  at SQLite4Unity3d.SQLiteCommand+<ExecuteDeferredQuery>d__0`1[Person].MoveNext () [0x00000] in <filename unknown>:0 
  at System.Collections.Generic.List`1[Person].AddEnumerable (IEnumerable`1 enumerable) [0x0001a] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:128 
  at System.Collections.Generic.List`1[Person]..ctor (IEnumerable`1 collection) [0x00025] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:65 
  at System.Linq.Enumerable.ToList[Person] (IEnumerable`1 source) [0x00000] in <filename unknown>:0 
  at SQLite4Unity3d.SQLiteCommand.ExecuteQuery[Person] () [0x00000] in <filename unknown>:0 
  at SQLite4Unity3d.TableQuery`1[Person].GetEnumerator () [0x00000] in <filename unknown>:0 
  at ExistingDBScript.ToConsole (IEnumerable`1 people) [0x00000] in E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Assets\Scripts\ExistingDBScript.cs:28 
  at ExistingDBScript.Start () [0x00012] in E:\@Documents\Unity Repos\SQLite4Unity3d\Example_unity5\Assets\Scripts\ExistingDBScript.cs:14 

(Filename: /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs Line: 128)

Setting up 1 worker threads for Enlighten.
  Thread -> id: 1f0 -> priority: 1 
Waiting for finish

EDIT: I think I found the issue. File.Copy is to slow or not executing properly. I get a copy of the file in the persistentDataPath, but it is empty (0 bytes). Not exactly sure why that's happening, but I'll see if I can figure it out. If you have any ideas I'd love to hear it. Maybe there needs to be a callback for the file copy process.

Naphier commented 8 years ago

Fixed it. You are using preprocessor directive UNITY_WINRT in DataServices.cs you could probably just switch that to #else Cheers and thanks for the work on this!

robertohuertasm commented 8 years ago

Hi @Naphier I've just tested in a previous version and it works ok. I'm unable to reproduce it. I'll let you know when I've finished installing the latest version as I would like to understand the issue and fix it properly. ;D

Thanks for your feedback and investigation work! :smile:

robertohuertasm commented 8 years ago

Hi @Naphier, I'm unable to reproduce your issue... It just works... I'm using the latest version of Unity (5.3.1f) and Windows 10. I've kept the original code (no compilation directives modifed) and launched the app in x86 as per your attached picture. capture1 capture2

Do you have more info on what really happened or how to reproduce it?

Naphier commented 8 years ago

Strange. It has been 100% reproducible for me when the UNITY_WINRT directive is there. I change it to a simple #else and it works just fine. Unity's documentation says UNITY_WINRT == UNITY_WP8 | UNITY_WSA, that's Windows Phone 8 or Windows Store, so it would make sense that the directive is ignored in a standalone build. Seems really odd that it does work for you. At any rate, I've found what works for me. I appreciate the quick response though. Thanks!

robertohuertasm commented 8 years ago

No problem, just in case I will add and #else there and problem solved ;D