Skip to content

Adds extension-functions.c from http://www.sqlite.org/contrib #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 6, 2016

Conversation

dinedal
Copy link
Collaborator

@dinedal dinedal commented Mar 4, 2016

Description:

Provide mathematical and string extension functions for SQL queries using the loadable extensions mechanism. Math: acos, asin, atan, atn2, atan2, acosh, asinh, atanh, difference, degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp, log, log10, power, sign, sqrt, square, ceil, floor, pi. String: replicate, charindex, leftstr, rightstr, ltrim, rtrim, trim, replace, reverse, proper, padl, padr, padc, strfilter. Aggregate: stdev, variance, mode, median, lower_quartile, upper_quartile.

…=date to this distribution.

Description:
> Provide mathematical and string extension functions for SQL queries using the loadable extensions mechanism. Math: acos, asin, atan, atn2, atan2, acosh, asinh, atanh, difference, degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp, log, log10, power, sign, sqrt, square, ceil, floor, pi. String: replicate, charindex, leftstr, rightstr, ltrim, rtrim, trim, replace, reverse, proper, padl, padr, padc, strfilter. Aggregate: stdev, variance, mode, median, lower_quartile, upper_quartile.
@lovasoa
Copy link
Member

lovasoa commented Mar 4, 2016

Do you think it's a good idea to include extension functions by default? It makes sql.js bigger, and
since the beginning of the project, there have been requests for spatialite support (#89) and encryption (#54), but never for these functions.

Maybe it would be a better solution to be able to compile them if needed, with something like make sql-extension-functions.js.

@dinedal
Copy link
Collaborator Author

dinedal commented Mar 4, 2016

I understand, I went with this approach since I felt these functions fleshed out SQLite as a fuller database, most people expect a stdev() and the other aggregate functions.

But yes, can make this a separate file.

@dinedal
Copy link
Collaborator Author

dinedal commented Mar 4, 2016

I'm not particularly fond of the things I had to do to the Makefile to do this.

Ideas? Thoughts? I feel like we need a cleaner way to do these kinds of builds and testing if more "variants" of SQLite are done.

@dinedal
Copy link
Collaborator Author

dinedal commented Mar 5, 2016

It's probably worth noting the size difference here is really small after optimizations (in bytes)

4192    ./js/sql-extension-functions.js
4096    ./js/sql.js

@lovasoa
Copy link
Member

lovasoa commented Mar 5, 2016

Oh, I didn't realise how small the size difference was. And you are right, the Makefile gets really ugly... So, if you think it should be included be default, I think we'll do this.

@kripken: what do you think about that?

@kripken
Copy link
Collaborator

kripken commented Mar 5, 2016

Sounds ok to me too, to include by default.

@dinedal
Copy link
Collaborator Author

dinedal commented Mar 5, 2016

Thanks, I can make the change to include this by default.

@lovasoa
Copy link
Member

lovasoa commented Mar 5, 2016

Let's do it then :)

lovasoa added a commit that referenced this pull request Mar 6, 2016
@lovasoa lovasoa merged commit 68d7db6 into sql-js:master Mar 6, 2016
@lovasoa
Copy link
Member

lovasoa commented Mar 6, 2016

If you have time, and are still interested in doing awesome things for this project, you can have a look at #128

@dinedal
Copy link
Collaborator Author

dinedal commented Mar 6, 2016

I don't mind, I'll take a look

@tomthe
Copy link

tomthe commented Apr 6, 2018

I am confused: are the extension-functions somehow availible in sql.js? Because when I test them, I get an error like: "no such function: acos"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants