I can't seem to figure out how to deal with dates and "in" clauses for parameterized queries.
I'd be grateful if someone could tell me how to do it.
Thanks
Date
I have a date in string format, Postgresql wants that wrapped in apostrophes in order to accept it into a timestamp field
In clause
I'd be grateful if someone could tell me how to do it.
Thanks
Date
I have a date in string format, Postgresql wants that wrapped in apostrophes in order to accept it into a timestamp field
B4X:
Dim completeddate As String = "'" & "2020-03-29 13:12:56" & "'"
'This doesn't work
Main.SQL.ExecNonQuery2("INSERT INTO table1 (completeddate, field2) Values(?,?) ", Array As Object(completeddate, field2))
'This does work but I'd prefer it to have it all parameterized
Main.SQL.ExecNonQuery2( "INSERT INTO table1 (completeddate, field2) Values(" & completeddate & ",?) " ", Array As Object(field2))
In clause
B4X:
dim sID as string = "0, 1, 2"
'This doesn't work
Dim sQuery As String = "select * from table1 where id in (?)"
Dim rs As ResultSet = Main.SQL.ExecQuery2(sQuery, Array As Object(sID))
'This does work
Dim sQuery As String = "select * from table1 where id in ( " & sID & ")"
Dim rs As ResultSet = Main.SQL.ExecQuery(sQuery)