Dear Community,
I am developing an app, which connects to server via Remote Database Connector (RDC). Database used is SQLite. I successfully configured RDC according to this guide, where I set SQL command of file config.properties (server side):
Documentation of SQLite date and time functions is here.
SQL command should insert new record to DB, which represents a ticket with its start time (Since) and end time (Till). The duration of ticket has to be parametrised.
When I execute following commands from app:
... I expect there will be inserted one record to DB, which has following three fields:
... but, indeed, in the database there is:
When I change the SQL command in file config.properties (server side) with hardcoded value of 40 minutes:
... everything works smooth and in DB I get value of field "Till" 40 minutes later then the value of "Since". According to my primitive diagnostics it seems, that parameters sent from DB, which are inside of SQLite functions (e.g. DATETIME) are not considered as parameter, but are just ignored.
Please, is there any solution, how can I insert two DATETIME values to DB with delta parameter (let's say 40 minutes)?
Thank you.
I am developing an app, which connects to server via Remote Database Connector (RDC). Database used is SQLite. I successfully configured RDC according to this guide, where I set SQL command of file config.properties (server side):
B4X:
sql.insert_ticket = INSERT INTO Tickets(Ticket_identifier, Since, Till) VALUES(?, DATETIME('now'), DATETIME('now', '+? minutes'))
Documentation of SQLite date and time functions is here.
SQL command should insert new record to DB, which represents a ticket with its start time (Since) and end time (Till). The duration of ticket has to be parametrised.
When I execute following commands from app:
B4X:
Dim reqManager As DBRequestManager
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "insert_ticket"
cmd.Parameters = Array As Object("abcdefghijkl", 40)
reqManager.ExecuteCommand(cmd, "insert_ticket")
... I expect there will be inserted one record to DB, which has following three fields:
- Ticket_identifier: "abcdefghijkl"
- Since: 23.12.2015 22:30:00
- Till: 23.12.2015 23:10:00
... but, indeed, in the database there is:
- Ticket_identifier: "abcdefghijkl"
- Since: 23.12.2015 22:30:00
- Till: NULL
When I change the SQL command in file config.properties (server side) with hardcoded value of 40 minutes:
B4X:
sql.insert_ticket = INSERT INTO Tickets(Ticket_identifier, Since, Till) VALUES(?, DATETIME('now'), DATETIME('now', '+40 minutes'))
... everything works smooth and in DB I get value of field "Till" 40 minutes later then the value of "Since". According to my primitive diagnostics it seems, that parameters sent from DB, which are inside of SQLite functions (e.g. DATETIME) are not considered as parameter, but are just ignored.
Please, is there any solution, how can I insert two DATETIME values to DB with delta parameter (let's say 40 minutes)?
Thank you.