Page 1 of 1

Help for SQLite

Posted: Fri Mar 15, 2019 4:59 pm
by zenzizenzizenzic
Is there a good source of information for this? I'd like to know what data types are available, and did not see that in the documentation.

Re: Help for SQLite

Posted: Fri Mar 15, 2019 7:43 pm
by airsoftsoftwair
The plugin is based on LuaSQLite3, so this might help:
http://lua.sqlite.org/index.cgi/doc/tip ... lite3.wiki

Re: Help for SQLite

Posted: Tue May 12, 2020 8:28 pm
by lazi
This was a long term problem of me, and obviously not a Hollywood one, rather than SQLite can be blamed for it.

SQLite string comparisons only works with ASCII characters. On all platforms.
When we use UTF-8 data,it is a pain handling the ORDER BY, LIKE, UPPER, LOWER and case insensitive comparisons. I have spent a lot of time to find a workaround without success.
As usual the solution is so simple that almost unbeliveable.

Similar to Hollywood where we can change internal functions easily the same feature is available for LuaSQLite too, which is the base of our plugin.

So, there is a sqlite3:create_function() method which could override standard SQLite functions. That's great!
Look at this, we can simply change SQLIite's UPPER function with Hollywood's one which is fully UTF-8 aware:

Code: Select all

db:create_function("UPPER", 1, Function(ctx,s) ctx:result(UpperStr(s)) EndFunction ) 
Simple enough, isn't it?

I love this, Andreas cheers! :)

The idea is came from this nice mind: https://techblog.dorogin.com/case-insen ... d4915079fc
The method's doc is here: http://lua.sqlite.org/index.cgi/doc/tip ... e_function

Re: Help for SQLite

Posted: Tue May 12, 2020 9:48 pm
by airsoftsoftwair
Great trick, thanks for sharing!

Re: Help for SQLite

Posted: Wed May 13, 2020 10:37 am
by Clyde
Very neat, thanks for sharing!