[Qgis-developer] Connect to Spatialite db from Pyqgis causes OperationalError: no such functions geometry constraints

a.furieri at lqt.it a.furieri at lqt.it
Wed Mar 31 18:05:31 EDT 2010


On Wed, 31 Mar 2010 15:43:12 -0430, Marcelo Reyes wrote
> ...  when I try to UPDATE or INSERT anything I get the folowing error:
>  
> OperationalError: no such functions geometry constraints
> 

Hi Marcelo,

the 'GeometryConstraints function not found' issue you are
experiencing can be very easily explained:

a) you've opened your DB using a recent SpatiaLite's version
    [presumably v.2.4.0-RC, if you're using QGIS 1.4]: in this
    case SpatiaLite silently converts any DB trigger to the
    most recent (and efficient) style.
b) then you are trying to load some obsolete DLL version in
    Python. but you cannot expect obsolete sw to be able 
    to support the most recent triggers.
c) the most recent DLL is named 'libspatialite-2.dll', so you
    are obviously using some obsolete DLL

please, update your DLLs to v.2.4.0-RC:
http://www.gaia-gis.it/spatialite-2.4.0/binaries.html

 
> I'm guessing this is because the libspatialite extension is not loaded, 
> but when I try to load it using query.exec_("SELECT load_extension('libspatialite-1.dll')") nothing happens.
>

this point is not at all clear to me: what do you intend when 
you state "nothing happens" ?
there are lots of reasons accounting for a failure [bad DLL's path, 
SQLite isn't enabled to load dynamic extensions, unresolved symbols ...] 
but for sure you'll get some error in this case.

Anyway, there is a "bomb proof" test you can perform to check
if the DLL was actually loaded or not:

SELECT spatialite_version();

if you get back a text string like "2.4.0" it's ok, you can safely
assume the DLL has been succesfully loaded.
otherwise you'll get some error like "no such function spatialite_version"

bye
Sandro
 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20100401/423321ff/attachment.html


More information about the Qgis-developer mailing list