I am not able to bind parameters in this code:
import org.influxdb.InfluxDB;
import org.influxdb.InfluxDBFactory;
import org.influxdb.dto.BoundParameterQuery;
import org.influxdb.dto.Query;
import org.influxdb.dto.QueryResult;
public class BindTest {
public static void main(String[] args) {
InfluxDB influxDB = InfluxDBFactory.connect("http://127.0.0.1:8086");
String s = "SELECT LAST(*) FROM batch_assembly_monitoring WHERE last_batch_start = $lbs";
Query query = BoundParameterQuery.QueryBuilder.newQuery(s)
.bind("lbs", 234567890)
.create();
System.out.println(query.getCommand());
QueryResult result = influxDB.query(query);
}
}
The output I get at stdout:
SELECT LAST(*) FROM batch_assembly_monitoring WHERE last_batch_start = $lbs
and also InfluxDB log contains this:
[httpd] 172.17.0.1 - - [24/Sep/2020:12:40:29 +0000] "POST /query?params=%7B%22lbs%22%3A234567890%7D&q=SELECT+LAST%28%2A%29+FROM+batch_assembly_monitoring+WHERE+last_batch_start+%3D+%24lbs HTTP/1.1" 200 89 "-" "okhttp/4.8.1" 20fe610d-fe63-11ea-81ba-0242ac110002 271
It seems binding parameters are not bound and a placeholder string is used in query instead of value 234567890.
What do I wrong?