gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnumed-devel] Up and Running Again


From: Richard Terry
Subject: [Gnumed-devel] Up and Running Again
Date: Wed, 11 Jan 2006 11:43:54 +1100
User-agent: KMail/1.9

Karsten the error is definately in this function as Ian said yesterday, except 
I don't know how to fix it, I've commented out the block to show where the 
thing crashes, and doing this allows it to compile. I did try what ian 
suggested putting  semi-colon  on the end of the line it appears to be 
missing on but didn't help.

BTW, I'd still like replies to my other questions about buildin the database 
without using this script as I'm using that experience to try and understand 
the gnumed structure.

Regards

richard T

===================================================
create or replace function dem.set_nickname(integer, text) returns integer as 
'
DECLARE
        _id_identity alias for $1;
        _nick alias for $2;

        _names_row record;
        msg text;
BEGIN
        -- 0.1: Just always set the nickname inside the active name
        -- post 0.1: openEHR-like (name: pk, fk_identity, name, fk_type, 
comment, 
is_legal, is_active ...)
        -- does name exist ?
        select into _names_row * from dem.names where id_identity = 
_id_identity and 
active = true;
               ****************************************************
                THE ERROR LIES IN THESE FEW LINES I THINK
              *****************************************************
        --if not FOUND then
                --msg := ''Cannot set nickname ['' || _nick || '']. No active 
<names> row 
with id_identity ['' || _id_identity || ''] --found.''
        --      raise exception msg;
        --end if;
             *****************************************************
        -- can directly set nickname ?
        -- if _names_row.preferred is null then
        update dem.names set preferred = _nick where id = _names_row.id;
        return _names_row.id;
        -- end if;
        -- must create new row
        -- 1) deactivate old row ...
        -- update dem.names set active = false where id = _names_row.id;
        -- 2) insert new row from old row  and new data ...
        --insert into dem.names (id_identity, active, firstnames, lastnames, 
preferred, comment)
        --      values (_id_identity, true, _names_row.firstnames, 
_names_row.lastnames, 
_nick, _names_row.comment);
        --if found then
        --      return currval(''names_id_seq'');
        --end if;
        --return NULL;
END;' language 'plpgsql';




reply via email to

[Prev in Thread] Current Thread [Next in Thread]