Command: SQLiteAddExtension
- Updated2024-09-12
- 3 minute(s) read
Command: SQLiteAddExtension
Command: SQLiteAddExtension
Loads an SQLite extension library to SQLite.
Input Parameters
SQLiteExtension |
Specifies the name SQL extension DLL. The SQL extension DLL is not part of the DIAdem installation. You must copy the DLL manually to the DIAdem program directory. DIAdem only supports 64-bit extensions. |
SQLiteEntryPoint |
Defines the entry point for the SQL extension. |
Example
The following example opens the SQLite database "Cities_1000_V4.4.sqlite" and loads the database extension "mod_spatialite4.dll" with the entry point "sqlite3_modspatialite_init". The example then performs various searches in the database and displays the results in the logfile.
| VBScript | Python |
Call SQLiteOpen(DataReadPath & "Cities_1000_V4.4.sqlite") Call SQLiteAddExtension("mod_spatialite4.dll", "sqlite3_modspatialite_init") Call SQLQuery("SELECT Name FROM cities1000 LIMIT 10;", True) Call SQLQuery("SELECT Name FROM cities1000 ORDER BY Distance(geom_wsg84, MakePoint(cast(12.4876180 AS DOUBLE), cast(41.9029000 AS DOUBLE), 4326)) LIMIT 5;", True) Call SQLQuery("SELECT * FROM knn WHERE f_table_name = 'cities1000' AND ref_geometry = MakePoint(cast(12.4876180 AS DOUBLE), cast(41.9029000 AS DOUBLE)) LIMIT 5;", True) Call SQLQuery("SELECT Name FROM cities1000 LIMIT 10;", False) Call SQLQuery("SELECT Name FROM cities1000 ORDER BY Distance(geom_wsg84, MakePoint(cast(12.4876180 AS DOUBLE), cast(41.9029000 AS DOUBLE), 4326)) LIMIT 5;", False) Call SQLQuery("SELECT * FROM knn WHERE f_table_name = 'cities1000' AND ref_geometry = MakePoint(cast(12.4876180 AS DOUBLE), cast(41.9029000 AS DOUBLE)) LIMIT 5;", False) Call SQLiteClose() Sub SQLQuery(sQuery, bOutputHeader) Dim aResult, sText, iRow, iColumn Call LogFileWrite("sQuery: " & sQuery) Call LogFileWrite("-----------------------------") Result = SQLiteQuery(sQuery, bOutputHeader) If IsArray(aResult) Then For iRow = lBound(aResult,1) To uBound(aResult,1) sText = "" For iColumn = lBound(aResult, 2) To uBound(aResult,2) sText = sText & Left(aResult(iRow, iColumn) & Space(25), 20) Next LogFileWrite(sText) Next End If Call LogfileWrite(" ") Call LogfileWrite(" ") End Sub
Related Topics
Command: SQLiteClose | Command: SQLiteOpen | Command: SQLiteQuery

