Hi everybody,

I am running ruby and need to access sqlite3 with the SpatiaLite spatial
extension enabled.
Info on SpatiaLite extension: http://www.gaia-gis.it/spatialite

Problem is, I can not find any description how to "enable_load_extension"
from ruby.
And without it no extension can be loaded for security reasons.


There is a description how to do it running this c code:
int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
on http://www.sqlite.org/c3ref/enable_load_extension.html

But how to enable it using ruby 1.8 (with sqlite3-ruby-1.2.4 gem)?

Thanks,
Jan

My non-working ruby script so far:

test.rb
#!/usr/bin/env ruby

require 'rubygems'
  require 'sqlite3'
  db = SQLite3::Database.new( "exif.sqlite" )

#Does NOT work:
#  db.execute('SELECT load_extension("libspatialite.so")')
#  db.execute( "SELECT Y(GpsGeometry), X(GpsGeometry),
DateTime(GpsTimestamp), FromPath FROM ExifPhoto" ) do |row|

# WORKS:
   db.execute( "SELECT DateTime(GpsTimestamp), FromPath FROM ExifPhoto" ) do
|row|

    p row
  end
  db.close
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to