2016-01-29 19:15:28 +00:00
|
|
|
require "db"
|
2015-03-12 21:21:33 +00:00
|
|
|
require "./sqlite3/**"
|
2016-06-22 19:17:47 +00:00
|
|
|
|
|
|
|
module SQLite3
|
|
|
|
DATE_FORMAT = "%F %H:%M:%S.%L"
|
2018-06-18 08:26:32 +00:00
|
|
|
|
|
|
|
# :nodoc:
|
|
|
|
TIME_ZONE = Time::Location::UTC
|
2020-11-11 18:00:40 +00:00
|
|
|
|
|
|
|
# :nodoc:
|
|
|
|
REGEXP_FN = ->(context : LibSQLite3::SQLite3Context, argc : Int32, argv : LibSQLite3::SQLite3Value*) do
|
|
|
|
argv = Slice.new(argv, sizeof(Void*))
|
|
|
|
pattern = LibSQLite3.value_text(argv[0])
|
|
|
|
text = LibSQLite3.value_text(argv[1])
|
|
|
|
LibSQLite3.result_int(context, Regex.new(String.new(pattern)).matches?(String.new(text)).to_unsafe)
|
|
|
|
nil
|
|
|
|
end
|
2016-06-22 19:17:47 +00:00
|
|
|
end
|