From 878495eac6191e6ebefdcbb3fa7b3377c9637fc1 Mon Sep 17 00:00:00 2001 From: Gil Moskowitz Date: Wed, 17 Sep 2014 11:13:54 -0400 Subject: [PATCH] temporarily separate qt-client locking from web client locking --- .../database/source/xt/functions/pg_advisory_unlock.sql | 4 ++++ enyo-client/database/source/xt/functions/trylock.sql | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/enyo-client/database/source/xt/functions/pg_advisory_unlock.sql b/enyo-client/database/source/xt/functions/pg_advisory_unlock.sql index c892882ca..25c3b7aff 100644 --- a/enyo-client/database/source/xt/functions/pg_advisory_unlock.sql +++ b/enyo-client/database/source/xt/functions/pg_advisory_unlock.sql @@ -1,4 +1,8 @@ create or replace function xt.pg_advisory_unlock(oid integer, id integer) returns boolean as $$ + var sql = "select pg_catalog.pg_advisory_unlock($1, $2) as result;"; + return plv8.execute(sql, [oid, id])[0].result; + /* temporary: let qt client use advisory locks but web client use xt.lock */ + var pid = plv8.execute("select pg_backend_pid() as pid;")[0].pid, username = plv8.execute("select geteffectivextuser() as username;")[0].username, sql = "select * from xt.lock where lock_table_oid = $1 and lock_record_id = $2 and lock_username = $3 and lock_pid = $4;", diff --git a/enyo-client/database/source/xt/functions/trylock.sql b/enyo-client/database/source/xt/functions/trylock.sql index 0c73312f6..719607b4d 100644 --- a/enyo-client/database/source/xt/functions/trylock.sql +++ b/enyo-client/database/source/xt/functions/trylock.sql @@ -1,4 +1,8 @@ create or replace function xt.trylock(oid integer, id integer) returns boolean as $$ + var sql = "select public.trylock($1, $2) as result;"; + return plv8.execute(sql, [oid, id])[0].result; + /* temporary: let qt client use advisory locks but web client use xt.lock */ + var pid = plv8.execute("select pg_backend_pid() as pid;")[0].pid, data = Object.create(XT.Data), lock = data.tryLock(oid, id, {pid: pid}); -- 2.39.2