tiny_sqlite
tiny_sqlite copied to clipboard
Feature: a `proc exec()` without auto-convert toDbValue
Feature request: a proc exec() that does not auto-convert toDbValue
Sometimes it can be handy to do the toDbValue conversion by hand.
dbWriteStatement is of type Table[string, SqlStatement]
if dbWriteStatement.hasKey(topic):
if datatype[topic] == "float":
let data = parseFloat(payload).float64
dbWriteStatement[topic].exec(topic, data)
elif datatype[topic] == "integer":
let data = parseInt(payload).int64
dbWriteStatement[topic].exec(topic, data)
elif datatype[topic] == "string":
let data = payload
dbWriteStatement[topic].exec(topic, data)
versus:
if dbWriteStatement.hasKey(topic):
if datatype[topic] == "float":
let data = toDbValue(parseFloat(payload).float64)
elif datatype[topic] == "integer":
let data = toDbValue(parseInt(payload).int64)
elif datatype[topic] == "string":
let data = toDbValue(payload )
dbWriteStatement[topic].exec(topic, data)