mirror of
https://github.com/sasjs/core.git
synced 2026-01-07 09:30:06 +00:00
fix: avoid error in mp_lockanytable.sas when unlocking a table that was not locked
This may happen due to the noprint option affecting the sqlobs variable. Closes #339
This commit is contained in:
14
all.sas
14
all.sas
@@ -10616,16 +10616,19 @@ run;
|
|||||||
%end;
|
%end;
|
||||||
%end;
|
%end;
|
||||||
%else %if &ACTION=UNLOCK %then %do;
|
%else %if &ACTION=UNLOCK %then %do;
|
||||||
%local status;
|
%local status cnt;
|
||||||
|
%let cnt=0;
|
||||||
proc sql noprint;
|
proc sql noprint;
|
||||||
|
select count(*) into: cnt from &ctl_ds where LOCK_LIB ="&lib" & LOCK_DS="&ds";
|
||||||
|
%if &cnt=0 %then %do;
|
||||||
|
%put %str(WAR)NING: &lib..&ds was not previously locked in &ctl_ds!;
|
||||||
|
%end;
|
||||||
|
%else %do;
|
||||||
select LOCK_STATUS_CD into: status from &ctl_ds
|
select LOCK_STATUS_CD into: status from &ctl_ds
|
||||||
where LOCK_LIB ="&lib" and LOCK_DS="&ds";
|
where LOCK_LIB ="&lib" and LOCK_DS="&ds";
|
||||||
quit;
|
quit;
|
||||||
%if &syscc>0 %then %put syscc=&syscc sqlrc=&sqlrc;
|
%if &syscc>0 %then %put syscc=&syscc sqlrc=&sqlrc;
|
||||||
%if &sqlobs=0 %then %do;
|
%if &status=LOCKED %then %do;
|
||||||
%put %str(WAR)NING: &lib..&ds has never been locked!;
|
|
||||||
%end;
|
|
||||||
%else %if &status=LOCKED %then %do;
|
|
||||||
data _null_;
|
data _null_;
|
||||||
putlog "&sysmacroname: unlocking &lib..&ds:";
|
putlog "&sysmacroname: unlocking &lib..&ds:";
|
||||||
run;
|
run;
|
||||||
@@ -10647,6 +10650,7 @@ run;
|
|||||||
%let abortme=1;
|
%let abortme=1;
|
||||||
%end;
|
%end;
|
||||||
%end;
|
%end;
|
||||||
|
%end;
|
||||||
%else %do;
|
%else %do;
|
||||||
%let msg=lock_anytable given unsupported action (&action);
|
%let msg=lock_anytable given unsupported action (&action);
|
||||||
%let abortme=1;
|
%let abortme=1;
|
||||||
|
|||||||
@@ -194,16 +194,19 @@ run;
|
|||||||
%end;
|
%end;
|
||||||
%end;
|
%end;
|
||||||
%else %if &ACTION=UNLOCK %then %do;
|
%else %if &ACTION=UNLOCK %then %do;
|
||||||
%local status;
|
%local status cnt;
|
||||||
|
%let cnt=0;
|
||||||
proc sql noprint;
|
proc sql noprint;
|
||||||
|
select count(*) into: cnt from &ctl_ds where LOCK_LIB ="&lib" & LOCK_DS="&ds";
|
||||||
|
%if &cnt=0 %then %do;
|
||||||
|
%put %str(WAR)NING: &lib..&ds was not previously locked in &ctl_ds!;
|
||||||
|
%end;
|
||||||
|
%else %do;
|
||||||
select LOCK_STATUS_CD into: status from &ctl_ds
|
select LOCK_STATUS_CD into: status from &ctl_ds
|
||||||
where LOCK_LIB ="&lib" and LOCK_DS="&ds";
|
where LOCK_LIB ="&lib" and LOCK_DS="&ds";
|
||||||
quit;
|
quit;
|
||||||
%if &syscc>0 %then %put syscc=&syscc sqlrc=&sqlrc;
|
%if &syscc>0 %then %put syscc=&syscc sqlrc=&sqlrc;
|
||||||
%if &sqlobs=0 %then %do;
|
%if &status=LOCKED %then %do;
|
||||||
%put %str(WAR)NING: &lib..&ds has never been locked!;
|
|
||||||
%end;
|
|
||||||
%else %if &status=LOCKED %then %do;
|
|
||||||
data _null_;
|
data _null_;
|
||||||
putlog "&sysmacroname: unlocking &lib..&ds:";
|
putlog "&sysmacroname: unlocking &lib..&ds:";
|
||||||
run;
|
run;
|
||||||
@@ -225,6 +228,7 @@ run;
|
|||||||
%let abortme=1;
|
%let abortme=1;
|
||||||
%end;
|
%end;
|
||||||
%end;
|
%end;
|
||||||
|
%end;
|
||||||
%else %do;
|
%else %do;
|
||||||
%let msg=lock_anytable given unsupported action (&action);
|
%let msg=lock_anytable given unsupported action (&action);
|
||||||
%let abortme=1;
|
%let abortme=1;
|
||||||
|
|||||||
Reference in New Issue
Block a user