SQLite Forum

Timeline
Login

8 forum posts by user wangfenjin

2021-02-28
07:18 Edit reply: How to get the extension path? (artifact: 535c702a84 user: wangfenjin)

Why on earth would you want that information?

In the title: this extension will read some other txt files. I will put the extension and txt file in the same folder. So if we can get the path of the extension, we will know where to read the txt files.

this is an Operating System question and has nothing to do with SQLite3.

Yes it's related to OS, but we can't say it has nothing to do with SQLite

Because SQLite should know the full path as it need to load the extension, for now seems SQLite just don't remember it and expose api about it. I ask this question to confirm it.

BTW, I think it will be good if SQLite have this info and maybe can pass to the sqlite_$(extension)_init() as a params

07:10 Edit reply: How to get the extension path? (artifact: 48f19d9bf8 user: wangfenjin)

For now my solution is make user pass the txt file path to the extension, it's doable but don't you think it'll be better we can infer that from the extension path?

07:09 Reply: How to get the extension path? (artifact: c98fc194ae user: wangfenjin)

For now my solution is make user all pass the txt file path to the extension, it's doable but don't you think it'll be better we can infer that from the extension path?

07:05 Reply: How to get the extension path? (artifact: e80de4600c user: wangfenjin)

Why on earth would you want that information?

In the title: this extension will read some other txt files. I will put the extension and txt file in the same folder. So I we can get the path of the extension, we will know where to read the txt files.

this is an Operating System question and has nothing to do with SQLite3.

Yes it's related to OS, but we can't say it has nothing to do with SQLite

Because SQLite should know the full path as it need to load the extension, for now seems SQLite just don't remember it and expose api about it. I ask this question to confirm it.

BTW, I think it will be good if SQLite have this info and maybe can pass to the sqlite_$(extension)_init() as a params

2021-02-27
05:29 Reply: How to get the extension path? (artifact: 4e077b44ff user: wangfenjin)

Thanks Larry

02:32 Reply: How to get the extension path? (artifact: 08e3ef7c3b user: wangfenjin)

Sorry it's a misunderstanding.

I mean let's say I make an extension named libcode.so, I can put the libcode.so anywhere and use the full path to load it into sqlite.

In the source code of libcode.so, how can I get the full path of libcode.so

2021-02-02
03:25 Reply: Use custom string function in FTS5 match clause (artifact: 6d161a2caa user: wangfenjin)

Thanks Larry, you point me to the right direction!!!

After turn on quote mode, I see actually sqlite will try to escape single quote again, which means if my output is "''", it will make it to "''''"

sqlite> .mode quote
sqlite> select simple_query('''');
'"''''"'

All I need is return "'", and let sqlite escape for me, Thats awesome!

01:29 Post: Use custom string function in FTS5 match clause (artifact: c4948d1dc6 user: wangfenjin)

Hi, I build a FTS5 tokenizer to support Chinese and PinYin, and also provide a custom function to generate the match string from user's input.

It all works well except the input contains a single quote, at this case it can't be matched. But if I first select my_custom_function(input), then use the returned value in match clause, it works. Here are the code pieces:

sqlite> select simple_query('''');
"''"
sqlite> select '    ', simple_highlight(t1, 0, '[', ']') from t1 where x match simple_query('''');
sqlite> select '    ', simple_highlight(t1, 0, '[', ']') from t1 where x match '"''"';
    |@English &special _characters."[']bacon-&and[']-eggs%

Please help me on this. Thanks in advance!