1
0
mirror of https://github.com/sasjs/core.git synced 2025-12-10 14:04:36 +00:00

Merge pull request #330 from sasjs/issue329

fix: closes #329 by handling the case of unlocking a table that was n…
This commit is contained in:
Allan Bowe
2023-02-16 14:35:29 +00:00
committed by GitHub
3 changed files with 27 additions and 4 deletions

View File

@@ -2914,7 +2914,7 @@ run;
results. If it does not exist, it will be created, with the following format:
|TEST_DESCRIPTION:$256|TEST_RESULT:$4|TEST_COMMENTS:$256|
|---|---|---|
|User Provided description|PASS|Column &inds contained ALL columns|
|User Provided description|PASS|Dataset &inds contained ALL columns|
@version 9.2
@author Allan Bowe
@@ -2988,7 +2988,7 @@ run;
results. If it does not exist, it will be created, with the following format:
|TEST_DESCRIPTION:$256|TEST_RESULT:$4|TEST_COMMENTS:$256|
|---|---|---|
|User Provided description|PASS|Column &inds contained ALL columns|
|User Provided description|PASS|Dataset &inds contained ALL columns|
<h4> Related Macros </h4>
@@ -10484,7 +10484,10 @@ run;
where LOCK_LIB ="&lib" and LOCK_DS="&ds";
quit;
%if &syscc>0 %then %put syscc=&syscc sqlrc=&sqlrc;
%if &status=LOCKED %then %do;
%if &sqlobs=0 %then %do;
%put %str(WAR)NING: &lib..&ds has never been locked!;
%end;
%else %if &status=LOCKED %then %do;
data _null_;
putlog "&sysmacroname: unlocking &lib..&ds:";
run;

View File

@@ -200,7 +200,10 @@ run;
where LOCK_LIB ="&lib" and LOCK_DS="&ds";
quit;
%if &syscc>0 %then %put syscc=&syscc sqlrc=&sqlrc;
%if &status=LOCKED %then %do;
%if &sqlobs=0 %then %do;
%put %str(WAR)NING: &lib..&ds has never been locked!;
%end;
%else %if &status=LOCKED %then %do;
data _null_;
putlog "&sysmacroname: unlocking &lib..&ds:";
run;

View File

@@ -4,8 +4,10 @@
<h4> SAS Macros </h4>
@li mp_lockanytable.sas
@li mp_assert.sas
@li mp_assertcols.sas
@li mp_assertcolvals.sas
@li mp_assertscope.sas
@li mp_coretable.sas
**/
@@ -61,3 +63,18 @@ run;
desc=Ref is captured in unlock,
test=ANYVAL
)
/* attempt unlock of a table that was never locked */
%mp_lockanytable(UNLOCK,lib=no,ds=doesnotexist,ref=bye, ctl_ds=work.controller)
%mp_assert(
iftrue=(&syscc=0),
desc=Ability to unlock a table that was never locked,
outds=work.test_results
)
/* test for macro variable scope leakage */
%mp_assertscope(SNAPSHOT)
%mp_lockanytable(LOCK,lib=tmp,ds=testscope,ref=This Ref, ctl_ds=work.controller)
%mp_assertscope(COMPARE)