sqlite icon indicating copy to clipboard operation
sqlite copied to clipboard

sqlite3 math extension

Open bodemann opened this issue 2 years ago • 4 comments

I hope this is the right place to ask.

I'd like to use the math extension to be able to query like this: stmt := conn.Prep("SELECT cos(lat) FROM t WHERE rowid = $id;")

Does anybody know how I could activate it?

bodemann avatar Jul 23 '22 15:07 bodemann

I believe you need to add a define SQLITE_* to enable math and then possibly link against an appropriate library to provide math functions to C -lm.

anacrolix avatar Jul 24 '22 15:07 anacrolix

This could be something we expose as a build tag perhaps. Or just decide to include it always. I'm not strictly opposed to including the extension by default but open to the opinions of others.

AdamSLevy avatar Aug 04 '22 23:08 AdamSLevy

I think include it by default.

anacrolix avatar Aug 08 '22 05:08 anacrolix

Include it by default would be nice.

BTW: The sqlite binary from https://www.sqlite.org/download.html has quite a few extensions compiled in (I tested the linux binary). I would suggest this as a reference for what to include.

Thank you both for reacting to my question.

bodemann avatar Aug 11 '22 17:08 bodemann