@@ -707,8 +707,6 @@ def query(
707
707
f"Missing mandatory filter property: { mand_col } "
708
708
)
709
709
710
- # GA customisation - unindented until Line 755 (pagination)
711
- # if resulttype == "hits":
712
710
with DatabaseConnection (
713
711
self .conn_dic ,
714
712
self .table ,
@@ -729,9 +727,36 @@ def query(
729
727
# because of getFields ...
730
728
sql_query = f"SELECT COUNT(1) AS hits \
731
729
FROM { self .table } \
732
- { where_dict ['clause' ]} "
730
+ { where_dict ['clause' ]} #WHERE#"
731
+
732
+ # Assign where_dict["properties"] to bind_variables
733
+ bind_variables = {** where_dict ["properties" ]}
734
+
735
+ # Default values for the process_query function (sql_manipulator)
736
+ query_args = {
737
+ "offset" : offset ,
738
+ "limit" : limit ,
739
+ "resulttype" : resulttype ,
740
+ "bbox" : bbox ,
741
+ "datetime_" : datetime_ ,
742
+ "properties" : properties ,
743
+ "sortby" : sortby ,
744
+ "skip_geometry" : skip_geometry ,
745
+ "select_properties" : select_properties ,
746
+ "crs_transform_spec" : crs_transform_spec ,
747
+ "q" : q ,
748
+ "language" : language ,
749
+ "filterq" : filterq ,
750
+ }
751
+
752
+ # Apply the SQL manipulation plugin
753
+ extra_params ["geom" ] = self .geom
754
+ sql_query , bind_variables = self ._process_query_with_sql_manipulator_sup ( # noqa: E501
755
+ db , sql_query , bind_variables , extra_params , ** query_args
756
+ )
757
+
733
758
try :
734
- cursor .execute (sql_query , where_dict [ "properties" ] )
759
+ cursor .execute (sql_query , bind_variables )
735
760
except oracledb .Error as err :
736
761
LOGGER .error (
737
762
f"Error executing sql_query: { sql_query } : { err } "
@@ -741,9 +766,6 @@ def query(
741
766
hits = cursor .fetchone ()[0 ]
742
767
LOGGER .debug (f"hits: { str (hits )} " )
743
768
744
- # GA customisation - desable the return below (pagination)
745
- # return self._response_feature_hits(hits)
746
-
747
769
with DatabaseConnection (
748
770
self .conn_dic , self .table , properties = self .properties
749
771
) as db :
@@ -855,7 +877,6 @@ def query(
855
877
856
878
# Generate feature JSON
857
879
features = [self ._response_feature (rd ) for rd in row_data ]
858
- # GA customisation - "numberMatched": hits, (pagination)
859
880
feature_collection = {
860
881
"numberMatched" : hits ,
861
882
"type" : "FeatureCollection" ,
@@ -1359,4 +1380,4 @@ def _class_factory(
1359
1380
), f"class { class_name } should inherit from { super_cls .__name__ } "
1360
1381
LOGGER .debug (f"initialising { class_name } with params { kwargs } " )
1361
1382
obj = cls (** kwargs )
1362
- return obj
1383
+ return obj
0 commit comments