Postgres/Postgres-pr - some confusion

Discussion in 'Ruby' started by Nick Black, Nov 16, 2006.

  1. Nick Black

    Nick Black Guest

    Hello,

    I'm doing some work using the ruby postgres lirbaries and I'm slightly
    confused about a few things. I installed the postgres libraries
    using:

    gem install postgres posrgres-pr

    If I use:

    require 'rubygems'
    require 'postgres-pr/connection'

    I cannot use the following syntax:

    db = PGconn.connect($HOST, "", "", "", $DBNAME , $LOGIN, $PASS)


    Where as when I use:

    require 'rubygems'
    require 'postgres'

    This syntax is fine. So there is obviously a difference between the
    two libraries, but I'm kind of stuck for finding out exactly what the
    differences are. I need

    Based on this documentation:

    http://phrogz.net/rubylibs/rdoc/index.html

    and the docs from my local gems directory, I've got some things
    working. But, when I try and the the PGConn.quote method, ruby
    complains that there is no quote method, which according to the source
    code I can find, there isnt, but which is listed in the documentation.
    So I'm wondering if the documentation I have been looking at is
    incorrect, if I am missing some libraries, or if I am not requiring
    the correct libraries. I thought that the postgres-pr library was a
    wrapper for the postgres.c library?

    Any explanation / direction to documenation would be really
    appreciated. Even just confirming if there is a PGconn.quote method
    and which lirbary its in would be a great help!

    CHeers

    Nick
    Nick Black, Nov 16, 2006
    #1
    1. Advertising

  2. Nick Black

    Kashia Buch Guest

    Hi,

    >> orking. But, when I try and the the PGConn.quote method, ruby


    PGconn.escape(str) should be available.

    >> the correct libraries. I thought that the postgres-pr library was a
    >> wrapper for the postgres.c library?
    >>
    >>

    > I thought the same thing until I was writing some basic queries using the
    > connection and pgresult. The result type is different between the two.
    > I've moved away from using postgres-pr because of the inconsistencies and
    > belief that the c client will be faster anyway.


    Yes, the c extension is much better, not perfect though.

    When you have a look at Og (get 0.40 via rubygems), you'll see that a few
    things have to be done to make the -pr more compatible to the c ext.

    og/lib/og/adapter/postgresql/override.rb

    I think it was Neumann who made the postgres-pr wrapper, which is a thin
    layer around the dbi lib as far as I remember, it is pure Ruby, no C
    involved.

    Kash

    --
    Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
    Kashia Buch, Nov 16, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Y2J
    Replies:
    5
    Views:
    323
    Victor Bazarov
    Aug 19, 2006
  2. Replies:
    0
    Views:
    314
  3. Replies:
    9
    Views:
    315
  4. Old Echo
    Replies:
    8
    Views:
    104
    Robert Klemme
    Jun 14, 2008
  5. Alexander Trauzzi

    Some confusion on self and the like....

    Alexander Trauzzi, Jun 22, 2009, in forum: Ruby
    Replies:
    9
    Views:
    108
    Robert Klemme
    Jun 22, 2009
Loading...

Share This Page