Schema
Owner
postgres
Descriptions
args: auth_token - Add an authorization token to be used in current transaction.
Options
Option | Value |
---|---|
Returns |
boolean |
Language |
|
Parameters |
text |
Definition
CREATE OR REPLACE FUNCTION public.addauth (
text
)
RETURNS boolean AS
$span$
DECLARE
lockid alias for $1;
okay boolean;
myrec record;
BEGIN
-- check to see if table exists
-- if not, CREATE TEMP TABLE mylock (transid xid, lockcode text)
okay := 'f';
FOR myrec IN SELECT * FROM pg_class WHERE relname = 'temp_lock_have_table' LOOP
okay := 't';
END LOOP;
IF (okay <> 't') THEN
CREATE TEMP TABLE temp_lock_have_table (transid xid, lockcode text);
-- this will only work from pgsql7.4 up
-- ON COMMIT DELETE ROWS;
END IF;
-- INSERT INTO mylock VALUES ( $1)
-- EXECUTE 'INSERT INTO temp_lock_have_table VALUES ( '||
-- quote_literal(getTransactionID()) || ',' ||
-- quote_literal(lockid) ||')';
INSERT INTO temp_lock_have_table VALUES (getTransactionID(), lockid);
RETURN true::boolean;
END;
$span$
LANGUAGE 'plpgsql'
VOLATILE
CALLED ON NULL INPUT
SECURITY INVOKER
COST 100;
COMMENT ON FUNCTION public.addauth(text)
IS 'args: auth_token - Add an authorization token to be used in current transaction.';
This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 13/03/2014 13:23 |