Barebones SQLite support

Had a look and got exact same results. Looks like a windows specific problem as runs fine on my mac.

Thank you Casey for your attempt. Missing dll is indeed present in my case, so cannot understand if it’s a 32/64 bits discrepancy or a specific dll version (4.0.0.0) not matching.

Max

I have just installed Mono on my windows laptop, and have compiled DLL by myself with cil_compile.sh command to obtain SQLiteImpl.CIL.dll

It compiles the dll without errors, but when starting app, it agains claims mono.data.sqlite is missing.

So have taken mono.data.sqlite.dll from Mono binaries, and copied it to project directory, no joy. Copied it also to /simulator/Local… where I see other dlls, and restarted the app, same error.

Where you able to compile and run test.cs ?

$ mcs -r:SQLiteImpl.CIL.dll test.cs
$ mono test.exe

Yes, test.cs is compiled into test.exe without errors. But this is what I get running the exe

C:\Users\User\Desktop\fuse-sqlite-master>mono test.exe
Hello World
test.sqlite
ExecImpl create table if not exists ids (id integer primary key)

Unhandled Exception:
System.InvalidProgramException: Invalid IL code in Mono.Data.Sqlite.SqliteConnection:CreateDbCommand (): IL_0000: ret


  at System.Data.Common.DbConnection.System.Data.IDbConnection.CreateCommand () <0x3a7b0a8 + 0x00013> in <filename unknown>:0
  at SQLiteImpl.ExecImpl (System.String handler, System.String statement) <0x3a7aed8 + 0x00048> in <filename unknown>:0
  at Dela.Mono.Examples.HelloWorld.Main (System.String[] args) <0x3a40f70 + 0x00033> in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidProgramException: Invalid IL code in Mono.Data.Sqlite.SqliteConnection:CreateDbCommand (): IL_0000: ret


  at System.Data.Common.DbConnection.System.Data.IDbConnection.CreateCommand () <0x3a7b0a8 + 0x00013> in <filename unknown>:0
  at SQLiteImpl.ExecImpl (System.String handler, System.String statement) <0x3a7aed8 + 0x00048> in <filename unknown>:0
  at Dela.Mono.Examples.HelloWorld.Main (System.String[] args) <0x3a40f70 + 0x00033> in <filename unknown>:0

C:\Users\User\Desktop\fuse-sqlite-master>

Max,

Just a quick comment. You can still use the library to run on Android and iPhone if you like to use it. The problems you are experiencing are only on Windows Preview.

Thanks to Casey’s help I was able to make it run on Windows as well, by including the dll’s. The problem was that Fuse’s Mono on Windows isn’t bundled with Mono.Data.Sqlite, and that we needed sqlite3.dll as well. Please try again now, and let me know if you are able to make it run on Windows.

Bjorn you are the man !

the project now works on windows as well. Thank you very much

Max

Thanks for the tutorial. The example works perfectly in preview, but I think there is some problem in android device. It is showing just a white screen. Please provide some more example for Create,Insert, Delete operations. Do I have to work with .js, .uno and .ux file for any operation. Please make it clear.

The app is just doing SQL statements in JavaScript. The example and documentation on the page is all there is. If you connect to you android log you should be able to see the same as in preview.

Added support for placeholders "INSERT INTO table VALUES (?,?,?)",1,2,3 and rewrote iOS-code to Foreign Code.

It works great with Insert and Update.

Am I right that not all commands are supported, e.g. the following works var r = db.query(workoutDB, “select * from workout where Month=” + w_month ); // return the expected list

But not if working with placeholders. Month is defined as integer. var r = db.query(workoutDB, “select * from workout where Month=(?)”, w_month ); // returns an empty list

Try this: var r = db.query(workoutDB, "select * from workout where Month=?", w_month ); // returns an empty list

Still empty list. Could it be, because Month is a string? I first tried to have it as integer, but that I did not manage to get working.

Can you please include a complete test-case?

In MainView.ux in github it insert and selects, and this works with out problems.

Do you get anything when you SELECT * FROM workout ?

Yes, it lists all data.

Please post a complete test-case that does not list data. I suspect something wrong with your SQL.

Hi,

the whole project is here: https://drive.google.com/file/d/0B4oWw-0WhsI8WWxCZjVIaHJEb28/view?usp=sharing

Thank you. I found the error in my library. which caused numbers passed from JavaScript to be null.

I have fixed the library, and fixed your JavaScript to use the latest version of SQLite library.

https://gist.github.com/bolav/061e6c0ca63ed7e49a14

Thanks so far.

I downloaded all, but get compilation errors:

… \SQLiteDb.uno(37,3): E3128: Call to ‘Fuse.Scripting.NativeModule.Evaluate(string,Fuse.Scripting.Context)’ has some invalid arguments (Fuse.Scripting.Context,Fuse.Scripting.Object)

Similar message for …\SQLiteDB.uno(37,3).

Sorry. This project is updated to Fuse 0.10.