using sqlite extensions within Ruby

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

using sqlite extensions within Ruby

Will Parsons
I don't usually see questions about using SQLite3 from Ruby here, so I
hope this is not out of place.

Ruby is my normal programming language of choice nowadays, and I've
been very happy with the sqlite3 ruby gem to use SQLite3 within my
programs.  I'd now like to make use of the SQLite3 session extension
under Ruby using the sqlite3 gem, but can't figure out how to do that.

I'm currently using FreeBSD and have compiled sqlite3 with the
SESSION extension.

I previously asked this question on stackoverflow:

http://stackoverflow.com/questions/40875967/how-to-use-sqlite3-session-extension-with-ruby

and got the reply that no such support was available.  I'm hoping that
someone here may have helpful advice.

--
Will

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: using sqlite extensions within Ruby

Don V Nielsen
Like you, I like ruby and working with sqlite via sqlite3 gem. So you have
recompiled sqlite3 with the sessions extension. Correct? And this modified
sqlite3 is the nearest sqlite3 available in your execution path. Correct?
The sqlite_ruby library is an interface to sqlite3...the base model.
Granted, I have no knowledge of the sessions extension, nor any extension
for that matter. But I do not know how sqlite_ruby would have any language
to the extended functionality; it is simply unaware of the bindings. If the
functionality is available via function calls in the sql itself, have you
tried executing the sql directly, i.e.:

  conn =
ActiveRecord::Base.establish_connection(adapter:'sqlite3',database:DB_NAME)
  conn.connection.execute(pragma_this_or_that)
  conn.connection.execute(your_sql_with_functions)

Without you augmenting the sqlite3 gem and teaching it how to interact with
the new functions, I don't know how your would accomplish what you are
suggesting.

dvn

On Wed, Dec 7, 2016 at 12:07 PM, Will Parsons <[hidden email]>
wrote:

> I don't usually see questions about using SQLite3 from Ruby here, so I
> hope this is not out of place.
>
> Ruby is my normal programming language of choice nowadays, and I've
> been very happy with the sqlite3 ruby gem to use SQLite3 within my
> programs.  I'd now like to make use of the SQLite3 session extension
> under Ruby using the sqlite3 gem, but can't figure out how to do that.
>
> I'm currently using FreeBSD and have compiled sqlite3 with the
> SESSION extension.
>
> I previously asked this question on stackoverflow:
>
> http://stackoverflow.com/questions/40875967/how-to-use-
> sqlite3-session-extension-with-ruby
>
> and got the reply that no such support was available.  I'm hoping that
> someone here may have helpful advice.
>
> --
> Will
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: using sqlite extensions within Ruby

Don V Nielsen
Documentation update to https://sqlite.org/sessionintro.html:

"The session extension provide a mechanism". Should that read, "The session
extension provides a mechanism"?

dvn

On Thu, Dec 8, 2016 at 9:23 AM, Don V Nielsen <[hidden email]> wrote:

> Like you, I like ruby and working with sqlite via sqlite3 gem. So you have
> recompiled sqlite3 with the sessions extension. Correct? And this modified
> sqlite3 is the nearest sqlite3 available in your execution path. Correct?
> The sqlite_ruby library is an interface to sqlite3...the base model.
> Granted, I have no knowledge of the sessions extension, nor any extension
> for that matter. But I do not know how sqlite_ruby would have any language
> to the extended functionality; it is simply unaware of the bindings. If the
> functionality is available via function calls in the sql itself, have you
> tried executing the sql directly, i.e.:
>
>   conn = ActiveRecord::Base.establish_connection(adapter:'sqlite3',
> database:DB_NAME)
>   conn.connection.execute(pragma_this_or_that)
>   conn.connection.execute(your_sql_with_functions)
>
> Without you augmenting the sqlite3 gem and teaching it how to interact
> with the new functions, I don't know how your would accomplish what you are
> suggesting.
>
> dvn
>
> On Wed, Dec 7, 2016 at 12:07 PM, Will Parsons <[hidden email]>
> wrote:
>
>> I don't usually see questions about using SQLite3 from Ruby here, so I
>> hope this is not out of place.
>>
>> Ruby is my normal programming language of choice nowadays, and I've
>> been very happy with the sqlite3 ruby gem to use SQLite3 within my
>> programs.  I'd now like to make use of the SQLite3 session extension
>> under Ruby using the sqlite3 gem, but can't figure out how to do that.
>>
>> I'm currently using FreeBSD and have compiled sqlite3 with the
>> SESSION extension.
>>
>> I previously asked this question on stackoverflow:
>>
>> http://stackoverflow.com/questions/40875967/how-to-use-sqlit
>> e3-session-extension-with-ruby
>>
>> and got the reply that no such support was available.  I'm hoping that
>> someone here may have helpful advice.
>>
>> --
>> Will
>>
>> _______________________________________________
>> sqlite-users mailing list
>> [hidden email]
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: using sqlite extensions within Ruby

Rowan Worth-2
In reply to this post by Don V Nielsen
On 8 December 2016 at 23:23, Don V Nielsen <[hidden email]> wrote:

> Like you, I like ruby and working with sqlite via sqlite3 gem. So you have
> recompiled sqlite3 with the sessions extension. Correct? And this modified
> sqlite3 is the nearest sqlite3 available in your execution path. Correct?
>

I'm not well versed in ruby but I'd be *very* surprised if the sqlite3
executable is at all relevant to what the ruby gem is doing.

Some language bindings are built using a specific sqlite3.c amalgamation.
If the ruby gem is implemented this way, you may need to rebuild the whole
gem rather than just compiling sqlite3.

Alternately if the gem relies on a dynamic libsqlite3 you may be able to
convince it to use your manually compiled version. But convincing the
system's dynamic loader to use a specific lib can involve a bit of black
magic...

-Rowan
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users