mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-01-14 01:25:38 -05:00
Initial setup of environment service
This commit is contained in:
25
Environment/Service/Data/Queries/CreateReading.sql
Normal file
25
Environment/Service/Data/Queries/CreateReading.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
BEGIN TRANSACTION
|
||||
|
||||
INSERT Reading
|
||||
(Timestamp, Name, Model, Temperature, Pressure, Humidity, Luminance, GasResistance, ColorTemperature, AirQualityIndex)
|
||||
SELECT
|
||||
@Timestamp,
|
||||
@Name,
|
||||
@Model,
|
||||
@Temperature,
|
||||
@Pressure,
|
||||
@Humidity,
|
||||
@Luminance,
|
||||
@GasResistance,
|
||||
@ColorTemperature,
|
||||
@AirQualityIndex
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
Reading WITH (UPDLOCK, SERIALIZABLE)
|
||||
WHERE Timestamp = @Timestamp AND Name = @Name AND Model = @Model
|
||||
)
|
||||
|
||||
COMMIT TRANSACTION
|
||||
Reference in New Issue
Block a user