Opened 10 years ago

Last modified 9 years ago

#541 new defect

maia_languages table encoding

Reported by: mortonda@… Owned by: rjl
Priority: normal Milestone: post-1.0.3 triage
Component: General Version: 1.0.2
Severity: normal Keywords:
Cc:

Description

Need to fix the maia_languages table to have utf-8 encodings. Might want to use http://www.loc.gov/standards/iso639-2/ascii_8bits.html to refresh and update.

Change History (2)

comment:1 Changed 10 years ago by mortonda@…

Also of interest: A procedure to update or insert on postgresql:

CREATE TABLE db (a INT PRIMARY KEY, b TEXT);

CREATE FUNCTION merge_db(key INT, data TEXT) RETURNS VOID AS
$$
BEGIN
    LOOP
        -- first try to update the key
        UPDATE db SET b = data WHERE a = key;
        IF found THEN
            RETURN;
        END IF;
        -- not there, so try to insert the key
        -- if someone else inserts the same key concurrently,
        -- we could get a unique-key failure
        BEGIN
            INSERT INTO db(a,b) VALUES (key, data);
            RETURN;
        EXCEPTION WHEN unique_violation THEN
            -- do nothing, and loop to try the UPDATE again
        END;
    END LOOP;
END;
$$
LANGUAGE plpgsql;

SELECT merge_db(1, 'david');
SELECT merge_db(1, 'dennis');

and for mysql

comment:2 Changed 9 years ago by mortonda@…

  • Milestone changed from 1.0.3 to post-1.0.3 triage

On second thought, while it may not be entirely correct, it only matters when we have a translation ready. Let's not waste time on this now.

Note: See TracTickets for help on using tickets.