Re: PostgreSQL-Ruby extention: calling Postgres functions



I'm using the Postgres-ruby extention to connect to my Postgres db
(require 'postgres' etc)
Now I need to call existing db functions but I don't know how...
the function I want to call is

CREATE OR REPLACE FUNCTION sdr_new.pprocess_insert(pid_process
integer, pid_client integer, pid_entity integer, pppid integer,
ppid_process integer, pnotes character varying, pstatus integer,
plast_update timestamp without time zone, plogin_usuario character
varying, pip character varying)

as you can see it has a lot of parameter as well

Anyone could help me?

not sure how it is done with raw postgres driver (is it the exec()
method?) but if you use DBI (http://ruby-dbi.rubyforge.org/ ,
http://www.kitebird.com/articles/ruby-dbi.html) the .do() method should
do the trick.

The DBI in ruby is a standard method of interfacing to SQL databases (it
has drivers for several of them). Advantage is that the DBI interface is
pretty much same for all supported databases so in theory you could
switch the database (and use different database driver) but your code
would not change much...

Hope this helps,

Vlad
.



Relevant Pages

  • Accessing oracle from windows 2000
    ... and even read through the documentation on DBI and I can't find ... I have years of experience with PERL but i'm pretty new to databases and ... I'm trying to access an Oracle database from my windows 2000 ... DBI connectfailed: [ODBC Driver Ma ...
    (perl.dbi.users)
  • Re: [SLE] Relational Databases with SuSE 9.1
    ... >>Do you need a degree in data management to use Postgres of MySQL? ... You just need to understand the basics of databases. ... Not that it's impossible to learn mysql or postgres, ...
    (SuSE)
  • Re: DBIx::DBH - Perl extension for simplifying database connections
    ... >>reasonable to make the user understand the details of how to make a DBI ... > servers, ports, databases, users and passwords work. ... "MySQL/Pg model of how servers, ports, databases" work there's also ... names so that at least the host, port, and database can ...
    (perl.dbi.users)
  • Re: DAMMIT!
    ... suspended or cancelled driving licenses available in the ... gender, driver license number, and reporting State. ... would need to hook into 50 databases just to ...
    (rec.travel.usa-canada)
  • [SLE] SPAM: SOLVED: Re: [SLE] Staring programs at boot - first time at doing this
    ... in /etc/init.d (adhering to the init instructions) and containing ... but you can also put the command in the existing postgres startup script. ... My course of action will be, although I generally do not like modifying files which could be overwritten by an upgrade, is to modify the existing postgres in /etc/init.d and to keep a backup copy elsewhere. ... I understand that one instance of PostgreSQL can contain many databases; I do not wish to mix work and home databases in the same grouping. ...
    (SuSE)

Loading