Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: a proc exec() without auto-convert toDbValue #19

Open
Moaneschien opened this issue Oct 17, 2022 · 0 comments
Open

Feature: a proc exec() without auto-convert toDbValue #19

Moaneschien opened this issue Oct 17, 2022 · 0 comments

Comments

@Moaneschien
Copy link

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant