go-sqlite3 icon indicating copy to clipboard operation
go-sqlite3 copied to clipboard

Add build tag sqlite_math_functions

Open nkt-dk opened this issue 2 years ago • 5 comments

Add build tag sqlite_math_functions to enable built-in scalar math functions using compiler flag SQLITE_ENABLE_MATH_FUNCTIONS. For reference: https://www.sqlite.org/lang_mathfunc.html.

I also updated the readme file, please let me know if you have any comments

nkt-dk avatar Apr 29 '22 19:04 nkt-dk

I think this extension requires linking to math.h:

#cgo LDFLAGS: -lm

lggruspe avatar May 04 '22 09:05 lggruspe

Thank you for the feedback, I think you are correct. I updated the PR and added the linker flag

nkt-dk avatar May 06 '22 19:05 nkt-dk

Please also update the GitHub merge gate to include this new tag in the "Tags: full" step. https://github.com/mattn/go-sqlite3/blob/bedc2985efda510946f102c1e2a5595be070a2b7/.github/workflows/go.yaml#L46-L47

It would also be helpful to include a unit test (with the same build tag) to verify that the SQLite math functions are compiled in. I don't think it's necessary to cover all of them, just pick one to ensure the build options are being set properly. https://www.sqlite.org/lang_mathfunc.html

rittneje avatar May 08 '22 23:05 rittneje

@nkt-dk Just giving you a ping on this, would be good to get the build flag in sometime :)

bearbin avatar Jul 12 '22 22:07 bearbin

Hi @bearbin, I did not have much time lately but @lggruspe continued this fix and create a new PR here: https://github.com/mattn/go-sqlite3/pull/1059 Thus I think my PR can be closed and we continue in 1059?

nkt-dk avatar Jul 16 '22 08:07 nkt-dk

superseded by #1059

rittneje avatar Sep 17 '22 14:09 rittneje