[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Help on SQLITE3-ruby (1.2.3) Windows problem

jhs408

1/24/2009 5:08:00 AM

Your Help please:

I have installed sqlite3 in directory : c:\tools\sqlite3and performed gem install : gem install sqlite3-ruby-1.2.3-
mswin32.gem

test2.rb program:
#--------------------------------------------------------------
require 'rubygems'
require 'sqlite3/database'
require 'sqlite3'

File.delete "test.db" rescue nil

db = SQLite3::Database.new( "test.db" )
sql = <<SQL
create table the_table (
a varchar2(30),
b varchar2(30)
);

insert into the_table values ( 'one', 'two' );
insert into the_table values ( 'three', 'four' );
insert into the_table values ( 'five', 'six' );
SQL

db.execute_batch( sql )


db.execute( "select * from the_table" ) do |row|
p row
end
#-----------------------------------------------------------

** upon executing the program: ruby test2.rb

it can not file sqlite3.dll

But when I move aa copy of sqlite3.dll into the same directory as
test2.rb
then everything runs OK.

Question: How do I condition sqlite3-ruby to load the sqlite3.dll
from the directory c:\tools\sqlite3?

Thanks for your assistance,
John
4 Answers

Bosko Ivanisevic

1/24/2009 9:05:00 AM

0

On Jan 24, 6:08 am, jhs...@gmail.com wrote:
> Your Help please:
>
> I have installed sqlite3 in directory :  c:\tools\sqlite3> and performed gem install :  gem install sqlite3-ruby-1.2.3-
> mswin32.gem
>
> test2.rb  program:
> #--------------------------------------------------------------
> require 'rubygems'
> require 'sqlite3/database'
>   require 'sqlite3'
>
>   File.delete "test.db" rescue nil
>
>    db = SQLite3::Database.new( "test.db" )
>  sql = <<SQL
>      create table the_table (
>        a varchar2(30),
>        b varchar2(30)
>      );
>
>      insert into the_table values ( 'one', 'two' );
>      insert into the_table values ( 'three', 'four' );
>      insert into the_table values ( 'five', 'six' );
> SQL
>
>    db.execute_batch( sql )
>
> db.execute( "select * from the_table" ) do |row|
>     p row
>   end
> #-----------------------------------------------------------
>
> ** upon executing the program:  ruby test2.rb
>
>    it can not file sqlite3.dll
>
> But when I move aa copy of sqlite3.dll into the same directory as
> test2.rb
> then everything runs OK.
>
> Question:  How do I condition sqlite3-ruby to load the sqlite3.dll
> from the directory c:\tools\sqlite3?
>
> Thanks for your assistance,
> John

Put c:\tools\sqlite3 in the PATH environment variable.

Luis Lavena

1/24/2009 4:01:00 PM

0

On Jan 24, 3:08 am, jhs...@gmail.com wrote:
> Your Help please:
>
> I have installed sqlite3 in directory :  c:\tools\sqlite3> and performed gem install :  gem install sqlite3-ruby-1.2.3-
> mswin32.gem
>
> test2.rb  program:
> #--------------------------------------------------------------
> require 'rubygems'
> require 'sqlite3/database'
>   require 'sqlite3'
>
>   File.delete "test.db" rescue nil
>
>    db = SQLite3::Database.new( "test.db" )
>  sql = <<SQL
>      create table the_table (
>        a varchar2(30),
>        b varchar2(30)
>      );
>
>      insert into the_table values ( 'one', 'two' );
>      insert into the_table values ( 'three', 'four' );
>      insert into the_table values ( 'five', 'six' );
> SQL
>
>    db.execute_batch( sql )
>
> db.execute( "select * from the_table" ) do |row|
>     p row
>   end
> #-----------------------------------------------------------
>
> ** upon executing the program:  ruby test2.rb
>
>    it can not file sqlite3.dll
>
> But when I move aa copy of sqlite3.dll into the same directory as
> test2.rb
> then everything runs OK.
>
> Question:  How do I condition sqlite3-ruby to load the sqlite3.dll
> from the directory c:\tools\sqlite3?
>
> Thanks for your assistance,
> John

For Windows to load shared libraries (.dll) needs to find those in any
of the directories of PATH, including the directory where the
executable (ruby.exe) is located.

Now, this is similar to LD_LIBRARY_PATH on *nix, but playing with it
is considered harmful [1]

sqlite3-ruby is built on Windows against the binary version of SQLite,
which requires the dll to be found in the PATH.

One alternative is add c:\tools\sqlite3 to the PATH:

SET PATH=%PATH%;C:\tools\sqlite3

The other alternative is put sqlite3.dll binary in the Ruby folder.

[1] http://linuxmafia.com/faq/Admin/ld-lib...

HTH,
--
Luis Lavena

Jeremy Hinegardner

1/24/2009 6:44:00 PM

0

On Sun, Jan 25, 2009 at 01:03:08AM +0900, Luis Lavena wrote:
> On Jan 24, 3:08?am, jhs...@gmail.com wrote:
> > Your Help please:
> >
> > I have installed sqlite3 in directory : ?c:\tools\sqlite3> > and performed gem install : ?gem install sqlite3-ruby-1.2.3-
> > mswin32.gem
> >
> > test2.rb ?program:
> > #--------------------------------------------------------------
> > require 'rubygems'
> > require 'sqlite3/database'
> > ? require 'sqlite3'
> >
> > ? File.delete "test.db" rescue nil
> >
> > ? ?db = SQLite3::Database.new( "test.db" )
> > ?sql = <<SQL
> > ? ? ?create table the_table (
> > ? ? ? ?a varchar2(30),
> > ? ? ? ?b varchar2(30)
> > ? ? ?);
> >
> > ? ? ?insert into the_table values ( 'one', 'two' );
> > ? ? ?insert into the_table values ( 'three', 'four' );
> > ? ? ?insert into the_table values ( 'five', 'six' );
> > SQL
> >
> > ? ?db.execute_batch( sql )
> >
> > db.execute( "select * from the_table" ) do |row|
> > ? ? p row
> > ? end
> > #-----------------------------------------------------------
> >
> > ** upon executing the program: ?ruby test2.rb
> >
> > ? ?it can not file sqlite3.dll
> >
> > But when I move aa copy of sqlite3.dll into the same directory as
> > test2.rb
> > then everything runs OK.
> >
> > Question: ?How do I condition sqlite3-ruby to load the sqlite3.dll
> > from the directory c:\tools\sqlite3?
> >
> > Thanks for your assistance,
> > John
>
> For Windows to load shared libraries (.dll) needs to find those in any
> of the directories of PATH, including the directory where the
> executable (ruby.exe) is located.
>
> Now, this is similar to LD_LIBRARY_PATH on *nix, but playing with it
> is considered harmful [1]
>
> sqlite3-ruby is built on Windows against the binary version of SQLite,
> which requires the dll to be found in the PATH.
>
> One alternative is add c:\tools\sqlite3 to the PATH:
>
> SET PATH=%PATH%;C:\tools\sqlite3
>
> The other alternative is put sqlite3.dll binary in the Ruby folder.

Another option is to use Amalgalite which embeds SQLite in the ruby extension,
no need to download the sqlite3.dll separately. If you are using sqlite
directly then that is a good option. if you need to use ActiveRecord or Sequel
or something like that, the drivers for ORM's do not exist, yet.

enjoy,

-jeremy

--
========================================================================
Jeremy Hinegardner jeremy@hinegardner.org


jayrichardm

6/23/2013 5:00:00 PM

0

On Sunday, June 23, 2013 10:51:38 AM UTC-6, Good Morning wrote:
> In article <b72c9b9a-4d8c-4f7b-b9b1-a65a8ec37a29@googlegroups.com>, Jay Richard
>
> Morrison says...
>
> >
>
> >On Saturday, June 22, 2013 9:37:08 PM UTC-6, Good Morning wrote:
>
> >>In article <f6385dfd-1fb3-470a-bd20-7c4920c7fe08@googlegroups.com>, Jay Richard
>
> >>Morrison says...
>
> >>
>
> >> >On Saturday, June 22, 2013 3:17:35 PM UTC-6, Good Morning wrote:
>
> >>
>
> >>>>In article <45bd560e-1be5-4e92-83f5-90987d61d97d@googlegroups.com>, Jay
>
> >>Richard Morrison says...
>
> >>
>
> >>
>
> >> >>>I have paid my dues and did what I
>
> >> >>>did for the pure purpose of helping Christ accomplish something
>
> >> >>>he wanted done. I have earned my reward and in time I
>
> >> >>>will be given that reward. It is just a matter of time
>
> >> >>>before you will end up being one of my niggers too.
>
> >>
>
> >> >> Jesus promised you "niggers" in the afterlife?
>
> >>
>
> >> >Read the 76th section of the D&C.
>
> >>
>
> >> I didn't see anything about "niggers" there.
>
> >> Do you think that D&C 76 indicates that faithful Mormons
>
> >> will be rewarded with black slaves to serve them in the afterlife?
>
> >
>
> >From the way you phrased your first post is obvious that you are
>
> >just trying to make an ass of yourself. But to understand where I
>
> >am coming from you have to have read a previous post of mine. Please
>
> >do your home work and read this:
>
> >
>
> >https://groups.google.com/forum/?f...!topic/alt.religion.mormon/usfOWGGVj2I
>
> >
>
>
>
> Leave it to Mormon to have a non-standard definition
>
> for a common word, use it in public, offer a non-explanation
>
> when asked about it, then finally admit it while berating you
>
> condescendingly. It's obvious who the ass is here, and it ain't me.
>
>
>
> You are proof once again that Mormonism is nothing
>
> but white boys making shit up -- 19th-century American
>
> white boys, to be specific. They made up a heaven that
>
> mirrored the male desires of their ilk and time -- a multi-tiered
>
> class system with themselves at the top, waited on by slaves,
>
> and in possession of a harem of beautiful women in an
>
> environment where monogamy is banished.
>
>
>
> You probably fancy yourself more honest than the
>
> vast majority of Mormon men and women who would
>
> never say that they were looking forward to being
>
> attended to in their afterlife by "niggers".
>
>
>
> You would probably defend that your mad religion
>
> is nothing like the historical American slavery of blacks.
>
> It's not "man's law" of slavery, right?
>
>
>
> No, it's just a 19th-century white boy fantasy that goes
>
> far beyond the "man's law" of slavery of their time
>
> -- a dream of turning every non-Mormon regardless
>
> of race, color or incorrect creed into a "nigger" for a Mormon.
>
> To be, as you put it, their "slave, indentured servant,
>
> personal property, one who is forced to work for nothing."
>
>
>
> It's taken a very long time for followers of Jesus
>
> to destroy systems of slavery and the once-prevalent
>
> thinking of people as personal property, forced to work
>
> for nothing, and the struggle goes on even at this late date
>
> -- but you have the audacity to brag haughtily of
>
> the "niggers" you'll acquire as a reward for your
>
> literally personal service to Jesus!
>
>
>
> Yes, it's obvious who the ass is here.

How about these words then: confusing, vague, irrational
illogical, inconsistent, inapplicable. All of those
seem to apply.