Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 6c8d770

Browse files
committed
common: Add (the official) Math functions to the SQLite authorizer white list
These are the ones enabled using the -DSQLITE_ENABLE_MATH_FUNCTIONS compile time option, not the prior (widely used) math extension.
1 parent c341a8b commit 6c8d770

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

common/sqlite.go

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,37 @@ const (
151151
fnGeopolyWithin function = "geopoly_within"
152152
fnGeopolyXForm function = "geopoly_xform"
153153

154+
// Math functions: https://www.sqlite.org/lang_mathfunc.html
155+
fnACos function = "acos"
156+
fnACosH function = "acosh"
157+
fnASin function = "asin"
158+
fnASinH function = "asinh"
159+
fnATan function = "atan"
160+
fnATan2 function = "atan2"
161+
fnATanh function = "atanh"
162+
fnACeil function = "ceil"
163+
fnACeiling function = "ceiling"
164+
fnCos function = "cos"
165+
fnCosH function = "cosh"
166+
fnDegrees function = "degrees"
167+
fnExp function = "exp"
168+
fnFloor function = "floor"
169+
fnLn function = "ln"
170+
fnLog function = "log"
171+
fnLog10 function = "log10"
172+
fnLog2 function = "log2"
173+
fnMod function = "mod"
174+
fnPi function = "pi"
175+
fnPow function = "pow"
176+
fnPower function = "power"
177+
fnRadians function = "radians"
178+
fnSin function = "sin"
179+
fnSinH function = "sinh"
180+
fnSqrt function = "sqrt"
181+
fnTan function = "tan"
182+
fnTanH function = "tanh"
183+
fnTrunc function = "trunc"
184+
154185
// Other functions we should allow
155186
fnVersion function = "sqlite_version"
156187
)
@@ -265,6 +296,35 @@ var SQLiteFunctions = []function{
265296
fnGeopolySvg,
266297
fnGeopolyWithin,
267298
fnGeopolyXForm,
299+
fnACos,
300+
fnACosH,
301+
fnASin,
302+
fnASinH,
303+
fnATan,
304+
fnATan2,
305+
fnATanh,
306+
fnACeil,
307+
fnACeiling,
308+
fnCos,
309+
fnCosH,
310+
fnDegrees,
311+
fnExp,
312+
fnFloor,
313+
fnLn,
314+
fnLog,
315+
fnLog10,
316+
fnLog2,
317+
fnMod,
318+
fnPi,
319+
fnPow,
320+
fnPower,
321+
fnRadians,
322+
fnSin,
323+
fnSinH,
324+
fnSqrt,
325+
fnTan,
326+
fnTanH,
327+
fnTrunc,
268328
fnVersion,
269329
}
270330

0 commit comments

Comments
 (0)