Function to convert IP Address w.x.y.z to integer? #4063
-
I'd like to import a file of IPv4 addresses in the form w.x.y.z (e.g. 192.168.1.1) and convert them to the corresponding value as an integer. Does anyone have a function that can do this? Many thanks. PS I have seen the reverse function (integer -> string) many places, for example: https://sqlite-users.sqlite.narkive.com/mC4pSHS7/convert-integer-ip-address-to-string-ip-address-in-sqlite |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
You can go to SQLiteStudio's custom functions (https://github.com/pawelsalawa/sqlitestudio/wiki/User_Manual#custom-sql-functions) and add these functions: https://github.com/pawelsalawa/sqlitestudio/wiki/Qt_script_ip2int Remember that such functions work only when you operate on the database from the SQLiteStudio. If you want such functions in your own application using SQLite, you need to register & implement them in your application. |
Beta Was this translation helpful? Give feedback.
-
A follow-on question: How can I find other functions that have been created? I'm teaching myself SQL, and this is a fun tool! |
Beta Was this translation helpful? Give feedback.
-
Perfect! I wonder how I could have found that pagemyself? Perhaps the SQLiteStudio's custom functions page (https://github.com/pawelsalawa/sqlitestudio/wiki/User_Manual#custom-sql-functions) could have a link? Thanks again |
Beta Was this translation helpful? Give feedback.
You can go to SQLiteStudio's custom functions (https://github.com/pawelsalawa/sqlitestudio/wiki/User_Manual#custom-sql-functions) and add these functions:
https://github.com/pawelsalawa/sqlitestudio/wiki/Qt_script_ip2int
https://github.com/pawelsalawa/sqlitestudio/wiki/Qt_script_int2ip
Remember that such functions work only when you operate on the database from the SQLiteStudio. If you want such functions in your own application using SQLite, you need to register & implement them in your application.