robertohuertasm / SQLite4Unity3d

SQLite made easy for Unity3d
MIT License
1.29k stars 266 forks source link

Indexing on iOS causes JIT compile problem #21

Open markyama opened 9 years ago

markyama commented 9 years ago

I’m getting an exception when running on an iOS device if I add [Indexed] to an int column. The Exception occurs when I call CreateTable() on the ISQLiteConnection. If I remove the [Indexed] flag, the JIT exception goes away.

ExecutionEngineException: Attempting to JIT compile method 'System.Linq.OrderedEnumerable`1<SQLite4Unity3d.SQLiteConnection/IndexedColumn>:GetEnumerator ()' while running with --aot-only.

Is there a way to solve these JIT problems with System.Linq and iOS? Or must I live without indexes for iOS?

I’m using Unity 5.0.1f1 with Xcode 6.3.1.

I have not fully integrated SQLite4Unity3d into my app and I’m worried that if I go down this route if I’ll have future problems with JIT on iOS?

Thanks

robertohuertasm commented 9 years ago

Hi Markyama,

I will take a look at it as soon as possible and get back to you. You know it's a little tricky to solve some JIT limitations affecting reflection and sometimes is not possible to overcome the issues. I'll do my best and let you know.

Best regards.

pokehanai commented 9 years ago

Well, this document may be helpful(in some way; since it had written before IL2CPP came out.)

https://github.com/neuecc/UniRx/wiki/AOT-Exception-Patterns-and-Hacks

Marreck commented 9 years ago

Maybe you can just create the index by running the following after you have created the table?

_connection.Query<int>("CREATE INDEX tablename_idx ON tablename (columnname)");