I am using my own sqlite3.dll in electron. So i need to register all the functions of sqlite3 with 'ffi' that I need to use. It was working pretty well till now. Ex for sqlite3_exec, i've registered this in ffi as follows
var lib = ffi.library('sqlite3',sqlite3_exec': ['int', [sqlite3Ptr, 'string', 'pointer', 'pointer', stringPtr]],)
and while using i use it as follows:
var res = lib.sqlite3_exec(dbHandle, query, null, null, null);
It works perfect.
Now I need to create virtual table. So when i try to create virtual table with the same code, I get error. Did a bit of research and got to know that I need to register a function with ffi that will allow me to create virtual table.
the function is as follows:
'sqlite3_create_module': ['int',[sqlite3Ptr, 'string', 'pointer', 'pointer']]
This is basically C syntax, I need to pass address of following module as the third parameter
static sqlite3_module module = {
.iVersion = 1,
.xCreate = test_CreateConnect,
.xConnect = test_CreateConnect,
.xBestIndex = test_BestIndex,
.xDisconnect = test_DisconnectDestroy,
.xDestroy = test_DisconnectDestroy,
.xOpen = test_Open,
.xClose = test_Close,
.xFilter = test_Filter,
.xNext = test_Next,
.xEof = test_Eof,
.xColumn = test_Column,
.xRowid = test_Rowid,
.xRename = test_Rename,
};
Its in C syntax, I've tried to change it to JS syntax as much as possible, but still nothing positive.
So if you've any solution for this please help.