[Interest] Use SQLite math functions (-DSQLITE_ENABLE_MATH_FUNCTIONS) like sin and cos?

Till Oliver Knoll till.oliver.knoll at gmail.com
Wed Oct 26 16:01:34 CEST 2022


Am 25.10.22 um 18:40 schrieb Christian Ehrlicher:
> Am 24.10.2022 um 19:58 schrieb Till Oliver Knoll:
>>
>> Dear all,
>>
>> What is the least complicated way to enable the math functions that 
>> come with SQLite, when it is compiled with the 
>> -DSQLITE_ENABLE_MATH_FUNCTIONS switch?
>>
>> My empirical experiments with the binary Qt 5.15.2 (open source) 
>> release (but also some tests with the lastest Qt 6.4 binary release, 
>> for either Windows or macOS) suggest that the SQLite plugin that 
>> ships with Qt does not enable those "built in mathematical 
>> functions", as described here:
>>
>> https://www.sqlite.org/lang_mathfunc.html
>>
>> So do I:
>>
>>   * Recompile the Qt SQLite plugin, with the desired
>>     -DSQLITE_ENABLE_MATH_FUNCTIONS flag?
>>       o Disadvantages (?):
>>           + Need to download Qt source code
>>           + Probably complicates the build process... (I have "build
>>             actions" on github.com that currently "only" need to
>>             install the binary Qt distribution)
>>           + Feels a bit "overkill"
>>
>
> From my pov this is the correct way to add new functionality to a Qt 
> plugin. Even for github you can install your binary Qt distribution 
> and then replace the plugin with your own.
>
Yes, but that would imply that I had a recompiled Qt SQLite plugin in 
the first place, and that I would then also "check-in" somehow into my 
source repository / include into the "github action build step". 
Something I'd like to avoid, if possible.

Also, I am also trying to avoid to recompile Qt on my desktop(s): it is 
a simple "one man open source app", and I try to keep the development 
process (done in my spare time) as simple as possible, for the time 
being. Or in other words: it's been more than a decade ago since I 
compiled Qt from source (what was that, perhaps Qt 4.x?), but that was 
in a "professional environment" ;) I don't even have all the required 
SKDs installed, expecially not on Windows (the target platform - because 
the given "flight simulator" runs there, too - however I mostly develop 
on macOS ;))

In short: I am looking for a solution that - if possible - avoids having 
to (re-)compile Qt from source. For no other reason other than "I am 
lazy" ;)

> Are there any disadvantages when the math functions are enabled? Esp. 
> regarding to speed?
>
I can't tell for sure, since I do have little experience with SQLite 
apart from using it, but I would not expect any speed issues when 
enabling those "math functions".

Certainly https://www.sqlite.org/lang_mathfunc.html does not mention 
anything like this. But yes, the code size would grow by some. So if the 
goal of the Qt binary distribution was "minimal size" (which I don't 
believe is a particular goal - developers that /really/ care about size 
recompile Qt anyway with their own custom options, I would expect) then 
one could argue that all external libraries would also be compiled with 
a "minimal feature set". But again, I hope that the "omission" of the 
-DSQLITE_ENABLE_MATH_FUNCTIONS 
<https://www.sqlite.org/compile.html#enable_math_functions> wasn't a 
concious choice.

But perhaps someone else with more experience with SQLite could shed 
some light on this or has some experience why enabling this "math 
option" by default could be a bad choice?


> Feel free to open a bug report so we can discuss if this flag can be 
> added by default.
>
I just created a suggestion report here, if anyone wants to contribute 
information about those "math functions":

https://bugreports.qt.io/browse/QTBUG-108016


Thanks for your reply!

   Oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20221026/5be804c2/attachment.htm>


More information about the Interest mailing list