aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/DillerDao.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/DillerDao.js b/src/DillerDao.js
index 3a6601f..cae80d7 100644
--- a/src/DillerDao.js
+++ b/src/DillerDao.js
@@ -9,11 +9,11 @@ function DillerDao(tx) {
// -------------------------------------------------------------------------------------------------------------------
function devices() {
- return tx.many("SELECT " + deviceColumns + " FROM device");
+ return tx.manyOrNone("SELECT " + deviceColumns + " FROM device");
}
function deviceById(id) {
- return tx.oneOrNone("SELECT " + deviceColumns + " FROM device WHERE id=$1", id);
+ return tx.one("SELECT " + deviceColumns + " FROM device WHERE id=$1", id);
}
function deviceByKey(key) {
@@ -37,7 +37,7 @@ function DillerDao(tx) {
}
function devicePropertiesByDeviceId(deviceId) {
- return tx.many('SELECT ' + propertyColumns + ' FROM device_property WHERE device=$1', [deviceId]);
+ return tx.manyOrNone('SELECT ' + propertyColumns + ' FROM device_property WHERE device=$1', [deviceId]);
}
function insertDeviceProperty(deviceId, key) {
@@ -58,7 +58,7 @@ function DillerDao(tx) {
function valuesByPropertyId(propertyId, limit) {
limit = limit || 10;
- return tx.many('SELECT timestamp, coalesce(value_numeric::text, value_text) AS value FROM value WHERE property=$1 ORDER BY timestamp DESC LIMIT $2', [propertyId, limit]);
+ return tx.manyOrNone('SELECT timestamp, coalesce(value_numeric::text, value_text) AS value FROM value WHERE property=$1 ORDER BY timestamp DESC LIMIT $2', [propertyId, limit]);
}
function insertValue(propertyId, value) {