meta données pour cette page
  •  

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
schplurtziel:sqlite3-ipv4-ext [2012/08/08 17:17]
ztrulphcs [ipv4-sqlite-3.7.10.0-amalgamation.patch]
schplurtziel:sqlite3-ipv4-ext [2020/12/28 08:02] (Version actuelle)
ztrulphcs [sqlite ipv4 extension]
Ligne 1: Ligne 1:
 ====== sqlite ipv4 extension ====== ====== sqlite ipv4 extension ======
  
-date this document was last edited : 2012-02-02+date this document was last edited : Mon Apr 16 2018. and minor edition (links to sqlite.org) on 2020/12/28
  
 date the C source was last edited : 2011-06-19 date the C source was last edited : 2011-06-19
Ligne 164: Ligne 164:
 ===== what version of sqlite is it for ? ===== ===== what version of sqlite is it for ? =====
  
-This extension was first written for sqlite 3.5.9, and it works for me with sqlite3 3.7.6.3 (current sqlite3 version on Sun Jun 12 2011).+This extension was first written for sqlite 3.5.9, and it works for me with sqlite3 3.23.(current [[https://brew.sh/|brew]] sqlite3 version as of Mon Apr 16 2018).
  
 Now, there are 2 things in the archive file : Now, there are 2 things in the archive file :
Ligne 227: Ligne 227:
 ==== Makefile.MacOSX ==== ==== Makefile.MacOSX ====
  
-This is a makefile for building the dynamic extension under MacOSX (tested under 10.5 and 10.6)+This is a makefile for building the dynamic extension under MacOSX (tested under 10.5 and 10.6 10.9 and recently 10.13.4)
  
-Fisrt edit this file and set the INCLUDE=-I/... line to a directory that contains the file ''sqlite3ext.h''+Fisrt edit this file and set the INCLUDE=-I/... line to a directory that contains the file ''sqlite3ext.h''. For example, if you installed sqlite3 via [[https://brew.sh/|brew]], the line could read ''INCLUDE = -I/usr/local/opt/sqlite/include''
  
 Then, run Then, run
Ligne 235: Ligne 235:
   make -f Makefile.MacOSX   make -f Makefile.MacOSX
  
-and you should obtain a file named libsqliteipv4.dylib. This file is the extension you are going to load.+and you should obtain a file named libsqliteipv4.dylib. This file is the extension you are going to load. Feel free to copy this file wherever you see fit.
  
 ==== Makefile.linux ==== ==== Makefile.linux ====
Ligne 256: Ligne 256:
 ==== ipv4-sqlite-3.7.10.0-amalgamation.patch ==== ==== ipv4-sqlite-3.7.10.0-amalgamation.patch ====
  
-This is a patch for the file sqlite-amalgamation-3071000/sqlite3.c of sqlite-3.7.10.0. Once applied, it allows to build sqlite with the ''isinnet'' and ''isinrange'' functions. There is then no need to load an extension. If you want to incorporate SQLite code into a wider program, then the functions ''isinnet'' and ''isinrange'' will also go into you wider program, provided you ''#define SQLITE_IPV4_EXT_FUNC 1'' somewhere in your source.+^This file outdated and probably completely unusable ^ 
 + 
 +This is a patch for the file sqlite-autoconf-3071000/sqlite3.c of sqlite-3.7.10.0. Once applied, it allows to build sqlite with the ''isinnet'' and ''isinrange'' functions. There is then no need to load an extension. If you want to incorporate SQLite code into a wider program, then the functions ''isinnet'' and ''isinrange'' will also go into you wider program, provided you ''#define SQLITE_IPV4_EXT_FUNC 1'' somewhere in your source.
  
 Here are the steps you must follow to build sqlite with builtin ''isinnet'' and ''isinrange'' SQL functions. Here are the steps you must follow to build sqlite with builtin ''isinnet'' and ''isinrange'' SQL functions.
-  * download sqlite-amalgamation-3071000.zip from http://sqlite.org/download.html +  * download sqlite-autoconf-3071000.tar.gz from http://sqlite.org/download.html 
-  * unzip the archive with something like <code bash>unzip sqlite-amalgamation-3071000.zip</code> +  * untar the archive with something like <code bash>gzip -cd sqlite-autoconf-3071000.tar.gz | tar xf -</code> 
-  * put the patch file in the newly created directory ''sqlite-amalgamation-3071000'' +  * put the patch file in the newly created directory ''sqlite-autoconf-3071000'' 
-  * then cd into the ''sqlite-amalgamation-3071000'' directory and apply the patch.<code bash> +  * then cd into the ''sqlite-autoconf-3071000'' directory and apply the patch.<code bash> 
-cd sqlite-amalgamation-3071000+cd sqlite-autoconf-3071000
 patch -p1 <ipv4-sqlite-3.7.10.0-amalgamation.patch patch -p1 <ipv4-sqlite-3.7.10.0-amalgamation.patch
 </code> </code>
Ligne 281: Ligne 283:
  
 ==== ipv4-sqlite-3.7.6.3-amalgamation.patch ==== ==== ipv4-sqlite-3.7.6.3-amalgamation.patch ====
 +
 +^This file more outdated and probably completely unusable ^
  
 This is a patch for the file sqlite3.c of sqlite-3.7.6.3. Once applied, it allows to build sqlite with the ''isinnet'' and ''isinrange'' functions... This is a patch for the file sqlite3.c of sqlite-3.7.6.3. Once applied, it allows to build sqlite with the ''isinnet'' and ''isinrange'' functions...
Ligne 288: Ligne 292:
  
 ==== ipv4-sqlite-3.6.23.1-amalgamation.patch ==== ==== ipv4-sqlite-3.6.23.1-amalgamation.patch ====
 +
 +^This file really outdated and probably definitely completely unusable ^
  
 This is a patch for the file sqlite3.c of sqlite-3.6.23.1. Once applied, it allows to build sqlite with the ''isinnet'' and ''isinrange'' functions... This is a patch for the file sqlite3.c of sqlite-3.6.23.1. Once applied, it allows to build sqlite with the ''isinnet'' and ''isinrange'' functions...
Ligne 300: Ligne 306:
 ===== How to load the extension ===== ===== How to load the extension =====
  
-Please, see http://sqlite.org/cvstrac/wiki?p=LoadableExtensions. But, here follow some brief explanations+Please, see https://www.sqlite.org/loadext.html. But, here follow some brief explanations
  
-In your application, call sqlite3_enable_load_extension(db,1) to allow loading external libraries. Then load the library libsqliteipv4 using sqlite3_load_extension; the third argument should be 0. +  * In your application,\\ call [[https://www.sqlite.org/c3ref/enable_load_extension.html|sqlite3_enable_load_extension(db,1)]] to allow loading external libraries. Then load the library libsqliteipv4 using [[https://www.sqlite.org/c3ref/load_extension.html|sqlite3_load_extension]]; the third argument should be 0. 
- +  from within the sqlite3 CLI, **if it has been built with load extension enabled**, then try this :<WRAP>
-from within the sqlite3 CLI, **if it has been built with load extension enabled**, then try this :+
 <cli> <cli>
 sqlite> .load './libsqliteipv4.so' sqlite> .load './libsqliteipv4.so'
Ligne 314: Ligne 319:
  
 On a Macintosh, you would use ''.dylib'' instead of ''.so'', on windows, I guess you would use ''.dll'' instead of ''.so'' On a Macintosh, you would use ''.dylib'' instead of ''.so'', on windows, I guess you would use ''.dll'' instead of ''.so''
 +</WRAP>
 ===== BUGS ===== ===== BUGS =====
  
Ligne 323: Ligne 328:
 ==== Can I use the patch for other versions ? ==== ==== Can I use the patch for other versions ? ====
  
-Yes, probably.+Yes, probably. Well in fact, this true back in 2012. nowadays (2018) this is probably wrong. but giveit a try, you may be lucky.
  
 Since the extension is such a simple and small change to sqlite, it is reasonable to try to patch a version with a patch made for another version. Since the extension is such a simple and small change to sqlite, it is reasonable to try to patch a version with a patch made for another version.