Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 76 additions & 72 deletions sql/processEmptyRequest.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ begin

set @isPushAuth = 0;


if exists (
select 1 where uac.accountInfo(@code) regexp '.*(@upushauth)$'
) then
Expand All @@ -26,80 +25,85 @@ begin

end if;

if @result is null then
if @result is not null then
return @result;
end if;

set @result = xmlelement('d'
, xmlattributes ('STGTSettings' as "name")
, xmlconcat(

(select top 1 (
select xmlagg(xmldatum)
from openxml(xmlData,'*/*') with (
name varchar(32) '@name'
, xmldatum xml '@mp:xmltext'
) where name not in (
'ts'
, 'distanceFilter', 'requiredAccuracy', 'timeFilter'
, 'syncInterval', 'fetchLimit', 'syncServerURI'
, 'trackerAutoStart', 'trackerStartTime'
, 'trackerFinishTime'
)

) as xmlData
set @result = xmlelement('d'
, xmlattributes ('STGTSettings' as "name")
, xmlconcat(

(select top 1 (
select xmlagg(xmldatum)
from openxml(xmlData,'*/*') with (
name varchar(32) '@name'
, xmldatum xml '@mp:xmltext'
) where name not in (
'ts'
, 'distanceFilter', 'requiredAccuracy', 'timeFilter'
, 'syncInterval', 'fetchLimit', 'syncServerURI'
, 'trackerAutoStart', 'trackerStartTime'
, 'trackerFinishTime', 'checkingBattery'
)

from ch.entity
where name = 'STGTSettings'
order by id
)
) as xmlData

, xmlelement(
'double'
, xmlattributes ('distanceFilter' as "name")
, if @isPushAuth = 1 then 15 else 35 endif
)
, xmlelement(
'double'
, xmlattributes ('timeFilter' as "name")
, if @isPushAuth = 1 then 10 else 25 endif
)
, xmlelement(
'double'
, xmlattributes ('requiredAccuracy' as "name")
, 50
)
, xmlelement(
'double'
, xmlattributes ('fetchLimit' as "name")
, 20
)
, xmlelement(
'double'
, xmlattributes ('syncInterval' as "name")
, 240
)
, xmlelement(
'string'
, xmlattributes ('syncServerURI' as "name")
, 'https://asa0.unact.ru/chest'
)
, xmlelement(
'double'
, xmlattributes ('trackerAutoStart' as "name")
, if @isPushAuth = 1 then 0 else 1 endif
)
, xmlelement(
'double'
, xmlattributes ('trackerStartTime' as "name")
, 7
)
, xmlelement(
'double'
, xmlattributes ('trackerFinishTime' as "name")
, 21
)
));

end if;
from ch.entity
where name = 'STGTSettings'
order by id
)

, xmlelement(
'double'
, xmlattributes ('distanceFilter' as "name")
, if @isPushAuth = 1 then 15 else 35 endif
)
, xmlelement(
'double'
, xmlattributes ('timeFilter' as "name")
, if @isPushAuth = 1 then 10 else 25 endif
)
, xmlelement(
'double'
, xmlattributes ('requiredAccuracy' as "name")
, 50
)
, xmlelement(
'double'
, xmlattributes ('fetchLimit' as "name")
, 20
)
, xmlelement(
'double'
, xmlattributes ('syncInterval' as "name")
, 240
)
, xmlelement(
'string'
, xmlattributes ('syncServerURI' as "name")
, 'https://asa0.unact.ru/chest'
)
, xmlelement(
'double'
, xmlattributes ('trackerAutoStart' as "name")
, if @isPushAuth = 1 then 0 else 1 endif
)
, xmlelement(
'double'
, xmlattributes ('trackerStartTime' as "name")
, 7
)
, xmlelement(
'double'
, xmlattributes ('trackerFinishTime' as "name")
, 21
)
, xmlelement(
'double'
, xmlattributes ('checkingBattery' as "name")
, 0
)
));

set @result = (
select
Expand Down