Skip to content

Math extension #1224

Closed
Closed

Description

@Bilge

Is it possible to either incorporate the mathematical extension (extension-functions.c) into the core application or provide it as a compiled extension?

Activity

  1. justinclift commented on Nov 12, 2017

    @justinclift
    Member

    Interesting thought. If you compile it yourself, you should be able to load it in the extensions part of Preferences.

    Which OS are you using?

  2. Bilge commented on Nov 12, 2017

    @Bilge
    Author

    Windows 7.

  3. justinclift commented on Nov 12, 2017

    @justinclift
    Member

    k, you can probably get the extension compiled by setting up MSVC 2013 using the steps here:

    I've not personally tried to compile external SQLite extensions though, so you'd likely need to experiment a bit.

  4. Bilge commented on Nov 12, 2017

    @Bilge
    Author

    Since I'm not very familiar with C compiling I may have to insist on my original proposal. Notwithstanding my own capabilities, it seems others would benefit from official support, too.

  5. struck89 commented on Dec 14, 2017

    @struck89

    Hi @Bilge,
    I also think it would be a great addition to the queries to be able to add these math functions.

    Huge EDIT. I had many troubles. I made it work, the problem was quite stupid, loading a 32 bit extension on a 64bit DB Browser installation.
    The error (which was in Spanish) was not very helpful, since it only said "Module not found"

    I have the .so extension compiled for both 32 and 64 bits for Windows. Both work 😄
    extension-functions.zip

  6. justinclift commented on Dec 14, 2017

    @justinclift
    Member

    @struck89 Wow, that's really, really awesome!

    Any interest in writing up the steps on our Wiki so others can figure out similar for other extensions? Also, I might be able to follow along them and get it added into the official packaging process. 😄

  7. justinclift commented on Dec 14, 2017

    @justinclift
    Member

    @Bilge Do you have a few moments to test out the extension compiled by @struck89?

  8. mgrojo commented on Dec 14, 2017

    @mgrojo
    Member

    I can confirm that the extension-functions can be compiled and works also for Ubuntu 16.04. Here is a sin plot directly copied from the plot dock and pasted here (you can now do that 😄)

    imagen

  9. justinclift commented on Dec 14, 2017

    @justinclift
    Member

    Muaaa Haaa Haaa. This is really good stuff.

    Looking at the .c source file now, it has basic instructions for compiling on Linux and OSX at the top. Sounds like it'll be fairly easy on those platforms. Windows though... I'm having trouble figuring out the steps it'd need. 😕

    Just got it compiled and working on CentOS 7. Cool. 😄

    I wonder if there's a way we could have these automatically compiled into our builds (as per @Bilge 's request)? eg so no manual step needs to be done by the user to load them. Might play around with this a bit later, and see...

  10. justinclift commented on Dec 15, 2017

    @justinclift
    Member

    Looking into the history of this extension code, it seems to be public domain:

        https://www.mail-archive.com/sqlite-users@mailinglists.sqlite.org/msg16048.html

    That being the case, adding them into our builds wouldn't introduce any licensing problems (important). 😄

  11. justinclift commented on Dec 15, 2017

    @justinclift
    Member
  12. justinclift commented on Dec 15, 2017

    @justinclift
    Member

    @liamh Are there any gotchas we should keep an eye out for?

    Note - Hoping you're the correct Liam Healy there. 😉

  13. justinclift commented on Dec 15, 2017

    @justinclift
    Member

    As a data point, just received a response from Liam Healy, pointing at his canonical source repo for the functions. He accepts PR's (etc), in case anyone wants to expand things out and so on. 😄

        https://gitlab.com/liamh/extension-functions

  14. liamh commented on Dec 15, 2017

    @liamh

    You do have the right person.

    One of the emails referenced in this thread said " Also note that the typing on sqlite3_auto_extension() pointer is wrong. " If anyone has a patch to fix the problem, I'll take it if it's been tested. I'm a bit embarrassed that I said to post problems to the mailing list - I think I must have dropped off that mailing list years ago, so I haven't seen anything that's posted.

  15. 43 remaining items

  16. chrisjlocke commented on Dec 4, 2018

    @chrisjlocke
    Member

    I'm thinking "it shouldn't", but lets take a quick look at some Task Manager memory use figures to make sure.

    😆
    Windows isn't the best OS for this. Start up DB4S. 21.2 MB. Open a database. Jumps to 27.2 MB just opening the 'browse for database' dialog. Increases to 33 MB when I cancel that dialog. After a bit (flipped back to Edge to look up something) and its dropped back down to 10.9 MB. Windows is doing wacky things with the memory! In typing the above, its increased to 14.7 MB and I haven't done anything. Now 21 MB. Loaded the extension and it hasn't moved.

    Short answer (without fiddling some more) it'll have very little impact on performance. Certainly takes milliseconds to load, etc.

  17. justinclift commented on Dec 4, 2018

    @justinclift
    Member

    Cool, that's probably all we needed to check, just to be on the safe side. 😄

  18. justinclift commented on Dec 13, 2018

    @justinclift
    Member

    @SilvioGrosso That video you created showing the load of the math extension + calling a function from it was really helpful. Used that to make sure I was getting it correct for the macOS compilation of it today.

    Do you have a YouTube account or similar for putting it on? Thinking we could point people to it.

    Actually, might be better to make an updated one showing the exactly correct location to load from math.dll (Win) / math.dylib (macOS), so there's no ambiguity for people?

  19. SilvioGrosso commented on Dec 13, 2018

    @SilvioGrosso

    Hello @justinclift

    Just recorded a new video tutorial by way of the latest beta (3°) released today.
    I have worked on Windows 10 (64 bit).
    I have showed both the standard deviation (on numbers) and the reverse funciton (on strings) available with the math extension.

    In my very short video tutorial I also show how to locate the extension on Windows 10 (64 bit)

    You can try to look for my video tutorial on YouTube, by typing:
    Db Browser for sqlite - Math extension

    However, here is the direct link:
    https://www.youtube.com/watch?v=UDqowNoFJIo

    You can easily download this video from YouTube in case you need it for your personal use.

    BTW, feel free to ask for other video tutorials in case you need them...
    As usual, I can record them on Windows 10 (64 bit) with OBS [1]; I edit them with Shotcut [2].
    No audio voice is added on my video tutorials since my British pronunciation sucks (I am an Italian guy) :-)

    [1] https://obsproject.com/
    [2] https://shotcut.org/

  20. justinclift commented on Dec 13, 2018

    @justinclift
    Member

    Excellent. Just updated the 3.11.0-beta3 release info with a pointer to it.

    BTW, feel free to ask for other video tutorials in case you need them...

    Cool. That would be really welcome. Any interest in maybe setting up some kind of official DB4S channel for them on YouTube and getting stuff created there? 😄

    ... my British pronunciation sucks (I am an Italian guy).

    Yeah, I'm an Aussie. My (spoken) English tends to have swear words in it. 👼

  21. SilvioGrosso commented on Dec 14, 2018

    @SilvioGrosso

    Hello @justinclift

    Any interest in maybe setting up some kind of official DB4S channel for them on YouTube and getting stuff created there?

    Sure. No problem at all.

    At present, I am waiting for the stable version to be released in order to ascertain what features I can show in my video tutorials.
    For instance, many latest addition as "the uncomment code button", in the Execute SQL tab, are not available in the 3° beta. They are present in the nightly builds for future releases :-)

  22. justinclift commented on Dec 14, 2018

    @justinclift
    Member

    Yeah. It's taking a bunch of time to get 3.11 released. Tonnes of stuff (mostly not directly programming) has needed doing. That's all mostly done now, thus the speed up in releasing betas in the last few days. 😄

  23. justinclift commented on Jan 19, 2019

    @justinclift
    Member

    Noticed something with our Windows build batch files today. The maths extension for them is only being included with the SQLite builds, not the SQLCipher ones.

    We should probably get it added to the SQLCipher ones too.

  24. karim commented on Jan 19, 2019

    @karim
    Member

    The maths extension for them is only being included with the SQLite builds, not the SQLCipher ones.

    Since both SQLite and SQLCipher are included together, did you mean built against SQLite and not SQLCipher?

    I don't think that's necessary. The same .dll works for both SQLite and SQLCipher. Just tested it to confirm.

    It is just being built after SQLite in the build batch files, but it doesn't have to be. The reason is that it needs sqlite3ext.h header file to get the names of some of the required function, like sqlite3_load_extension. These functions exist in SQLite and SQLCipher.

    We build SQLite first, then move the extension .c/.def to the same folder (where sqlite3ext.h exist) and build there. We can also build it first, before SQLite and SQLCipher, by copying sqlite3ext.h file, from either, to its folder.

  25. justinclift commented on Jan 19, 2019

    @justinclift
    Member

    Thanks @karim. Yep, that was me forgetting we only need it built once, as both .exe's get installed in the same place.

    I'd probably just been faked out by looking through the macOS stuff before it, as that still needs to build both SQLite and SQLCipher completely separately. 😄

    So yeah, the math extension on Win is fine as-is. My bad. 😇

  26. karim commented on Jan 19, 2019

    @karim
    Member

    No worries. 😄

    Should we close this issue or wait till the 3.11 release?

  27. justinclift commented on Jan 19, 2019

    @justinclift
    Member

    Ahh yeah. Closing it. 😄

  28. added a commit that references this issue on Mar 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions