|
16 | 16 | import org.influxdb.InfluxDBException;
|
17 | 17 | import org.influxdb.InfluxDBIOException;
|
18 | 18 | import org.influxdb.dto.BatchPoints;
|
19 |
| -import org.influxdb.dto.BoundParameterQuery; |
20 | 19 | import org.influxdb.dto.Point;
|
21 | 20 | import org.influxdb.dto.Pong;
|
22 | 21 | import org.influxdb.dto.Query;
|
@@ -637,13 +636,17 @@ public void query(final Query query, final int chunkSize, final BiConsumer<Cance
|
637 | 636 | public void query(final Query query, final int chunkSize, final BiConsumer<Cancellable, QueryResult> onNext,
|
638 | 637 | final Runnable onComplete, final Consumer<Throwable> onFailure) {
|
639 | 638 | Call<ResponseBody> call;
|
640 |
| - if (query instanceof BoundParameterQuery) { |
641 |
| - BoundParameterQuery boundParameterQuery = (BoundParameterQuery) query; |
642 |
| - call = this.influxDBService.query(getDatabase(query), query.getCommandWithUrlEncoded(), chunkSize, |
643 |
| - boundParameterQuery.getParameterJsonWithUrlEncoded()); |
| 639 | + if (query.hasBoundParameters()) { |
| 640 | + if (query.requiresPost()) { |
| 641 | + call = this.influxDBService.postQuery(getDatabase(query), query.getCommandWithUrlEncoded(), chunkSize, |
| 642 | + query.getParameterJsonWithUrlEncoded()); |
| 643 | + } else { |
| 644 | + call = this.influxDBService.query(getDatabase(query), query.getCommandWithUrlEncoded(), chunkSize, |
| 645 | + query.getParameterJsonWithUrlEncoded()); |
| 646 | + } |
644 | 647 | } else {
|
645 | 648 | if (query.requiresPost()) {
|
646 |
| - call = this.influxDBService.query(getDatabase(query), query.getCommandWithUrlEncoded(), chunkSize, null); |
| 649 | + call = this.influxDBService.postQuery(getDatabase(query), query.getCommandWithUrlEncoded(), chunkSize); |
647 | 650 | } else {
|
648 | 651 | call = this.influxDBService.query(getDatabase(query), query.getCommandWithUrlEncoded(), chunkSize);
|
649 | 652 | }
|
@@ -716,18 +719,21 @@ public void onFailure(final Call<ResponseBody> call, final Throwable t) {
|
716 | 719 | @Override
|
717 | 720 | public QueryResult query(final Query query, final TimeUnit timeUnit) {
|
718 | 721 | Call<QueryResult> call;
|
719 |
| - if (query instanceof BoundParameterQuery) { |
720 |
| - BoundParameterQuery boundParameterQuery = (BoundParameterQuery) query; |
721 |
| - call = this.influxDBService.query(getDatabase(query), |
722 |
| - TimeUtil.toTimePrecision(timeUnit), query.getCommandWithUrlEncoded(), |
723 |
| - boundParameterQuery.getParameterJsonWithUrlEncoded()); |
| 722 | + if (query.hasBoundParameters()) { |
| 723 | + if (query.requiresPost()) { |
| 724 | + call = this.influxDBService.postQuery(getDatabase(query), TimeUtil.toTimePrecision(timeUnit), |
| 725 | + query.getCommandWithUrlEncoded(), query.getParameterJsonWithUrlEncoded()); |
| 726 | + } else { |
| 727 | + call = this.influxDBService.query(getDatabase(query), TimeUtil.toTimePrecision(timeUnit), |
| 728 | + query.getCommandWithUrlEncoded(), query.getParameterJsonWithUrlEncoded()); |
| 729 | + } |
724 | 730 | } else {
|
725 | 731 | if (query.requiresPost()) {
|
726 |
| - call = this.influxDBService.query(getDatabase(query), |
727 |
| - TimeUtil.toTimePrecision(timeUnit), query.getCommandWithUrlEncoded(), null); |
| 732 | + call = this.influxDBService.postQuery(getDatabase(query), |
| 733 | + TimeUtil.toTimePrecision(timeUnit), query.getCommandWithUrlEncoded()); |
728 | 734 | } else {
|
729 | 735 | call = this.influxDBService.query(getDatabase(query),
|
730 |
| - TimeUtil.toTimePrecision(timeUnit), query.getCommandWithUrlEncoded()); |
| 736 | + TimeUtil.toTimePrecision(timeUnit), query.getCommandWithUrlEncoded(), null); |
731 | 737 | }
|
732 | 738 | }
|
733 | 739 | return executeQuery(call);
|
@@ -788,10 +794,14 @@ public boolean databaseExists(final String name) {
|
788 | 794 | */
|
789 | 795 | private Call<QueryResult> callQuery(final Query query) {
|
790 | 796 | Call<QueryResult> call;
|
791 |
| - if (query instanceof BoundParameterQuery) { |
792 |
| - BoundParameterQuery boundParameterQuery = (BoundParameterQuery) query; |
| 797 | + if (query.hasBoundParameters()) { |
| 798 | + if (query.requiresPost()) { |
793 | 799 | call = this.influxDBService.postQuery(getDatabase(query), query.getCommandWithUrlEncoded(),
|
794 |
| - boundParameterQuery.getParameterJsonWithUrlEncoded()); |
| 800 | + query.getParameterJsonWithUrlEncoded()); |
| 801 | + } else { |
| 802 | + call = this.influxDBService.query(getDatabase(query), null, query.getCommandWithUrlEncoded(), |
| 803 | + query.getParameterJsonWithUrlEncoded()); |
| 804 | + } |
795 | 805 | } else {
|
796 | 806 | if (query.requiresPost()) {
|
797 | 807 | call = this.influxDBService.postQuery(getDatabase(query), query.getCommandWithUrlEncoded());
|
|
0 commit comments