I want to use PostgreSQL with macruby.  

At first I couldn't make this work.  I eventually had some success and learned 
quite a lot on the way.  I'm not sure whether I found a bug in macruby but it 
certainly behaves differently from ruby 1.9.2-p290 installed from macports. The 
latter worked with postgres with no problems.

My first try was with macruby 0.10 stable.  I couldn't get the pg gem 
(pg-0.11.0) to compile and eventually gave up.  There were lots of obscure 
errors which I regret I've not recorded.

I then moved onto macruby 0.11 which I compiled from source that I checked out 
today.  pg-0.11.0 now compiled but when I tried to use postgres from my macruby 
test I aborted with a failed dynamic link to ENCODING_GET_INLINED.  I soon 
realised this was another name for ENCODING_GET and I added the definition to 
macruby's encoding.h.

I could now get as far as connecting to postgres and retrieving a result set.  
However, as son as I tried to examine any of the values in the result set I 
aborted:

Assertion failed: (idx >= 0 && idx < ENCODINGS_COUNT), function 
rb_enc_associate_index, file encoding.c, line 590.
Abort trap: 6

I eventually found that pg was passing an idx of -1.  I modified the the pg 
code to prevent this happening and it now works fine, as far as I've gone.

It seems to me that pg should not pass an index of -1.  ruby 1.9.2-p290 however 
seems to accept it.  So who's right ?

Hope this is of interest to someone.

Steve



_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to