How to find power of a number in SQLite

前端 未结 7 1953
悲&欢浪女
悲&欢浪女 2020-12-09 17:39

I want to update the Interest field in my database. My SQL query is like as per below

Update Table_Name set Interest = Principal * Power(( 1 + (rate

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-09 18:21

    https://www.cafe-encounter.net/p3244/installing-and-using-sqlite-extensions-on-macos-and-maybe-windows-linux-too

    Step was to build the Math extensions library that some wonderful person named Liam Healy wrote:

    Enter following command in terminal :

    Step 1) Download/ Open link http://sqlite.org/contrib/download/extension-functions.c?get=25

    Step 2) Go to location where extension-functions.c is downloaded. Run command "gcc -fno-common -dynamiclib extension-functions.c -o libsqlitefunctions.dylib". This will create file libsqlitefunctions.dylib at same place then you can use that in your ios application from xcode.

    Now in your cocoa app you can add:

    “SELECT load_extension(’libsqlitefunctions.dylib’);”
    

    and then you have access to all kinds of glorious methods like COS, SQRT, etc! You can use them in your app like this:

    //Activate database loading
    sqlite3_enable_load_extension(database, 1);
    sqlite3_load_extension(database,”libsqlitefunctions.dylib”,0,0);
    

提交回复
热议问题