local refkey=$1; shift
local comment=$1; shift
local refinfo=$1; shift
+ local taskusername=$1; shift
echo "
INSERT INTO tasks
(type, refkey, username, comment, live, refinfo)
- VALUES ('xdbref','$refkey','$username@$nodename',
+ VALUES ('xdbref','$refkey','$taskusername',
'$comment','t','$refinfo');
"
}
for task in $tasks; do
psql_do <<END
BEGIN;
- $(make_xdbref_task $dbname 'borrowed for test db' $task)
+ $(make_xdbref_task $dbname 'borrowed for test db' \
+ $task "$username@$nodename")
UPDATE resources SET owntaskid = $(borrowtaskid $task)
WHERE owntaskid=$task;
COMMIT;
# As we copy, we note everything we're not borrowing as
# belonging to the parent db.
cat >>$t.import <<END
- $(make_xdbref_task $maindbname 'not borrowed' '')
+ $(make_xdbref_task $maindbname 'not borrowed' '' PARENT)
UPDATE resources
SET owntaskid = $(taskid xdbref $maindbname)
WHERE owntaskid != $(borrowtaskid $task);