* Some small fixes after testing: avoid AV when SQL logging requested and no connection available. Allow CORS on customview

git-svn-id: trunk@41805 -
This commit is contained in:
michael 2019-03-31 14:14:42 +00:00
parent c763fbf84b
commit d5a1e71c5e

View File

@ -900,7 +900,10 @@ function TSQLDBRestDispatcher.CreateCustomViewResource: TSQLDBRestResource;
begin
Result:=TCustomViewResource.Create(Nil);
Result.ResourceName:=FStrings.GetRestString(rpCustomViewResourceName);
Result.AllowedOperations:=[roGet];
if rdoHandleCORS in DispatchOptions then
Result.AllowedOperations:=[roGet,roOptions,roHead]
else
Result.AllowedOperations:=[roGet,roHead];
end;
function TSQLDBRestDispatcher.CreateMetadataResource: TSQLDBRestResource;
@ -1658,7 +1661,7 @@ begin
DoLog(rloConnection,IO,'Using connection to Host: %s; Database: %s',[Conn.HostName,Conn.DatabaseName])
else
DoLog(rloConnection,IO,'Resource %s does not require connection',[IO.ResourceName]);
if MustLog(rloSQL) then
if assigned(Conn) and MustLog(rloSQL) then
begin
Conn.LogEvents:=LogSQLOptions;
Conn.OnLog:=@IO.DoSQLLog;