Skip to content

Commit cdf0aae

Browse files
committed
Remove Oracle.py Customisations
1 parent 2b618c6 commit cdf0aae

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

pygeoapi/provider/oracle.py

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,6 @@ def query(
707707
f"Missing mandatory filter property: {mand_col}"
708708
)
709709

710-
# GA customisation - unindented until Line 755 (pagination)
711-
# if resulttype == "hits":
712710
with DatabaseConnection(
713711
self.conn_dic,
714712
self.table,
@@ -729,9 +727,36 @@ def query(
729727
# because of getFields ...
730728
sql_query = f"SELECT COUNT(1) AS hits \
731729
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+
733758
try:
734-
cursor.execute(sql_query, where_dict["properties"])
759+
cursor.execute(sql_query, bind_variables)
735760
except oracledb.Error as err:
736761
LOGGER.error(
737762
f"Error executing sql_query: {sql_query}: {err}"
@@ -741,9 +766,6 @@ def query(
741766
hits = cursor.fetchone()[0]
742767
LOGGER.debug(f"hits: {str(hits)}")
743768

744-
# GA customisation - desable the return below (pagination)
745-
# return self._response_feature_hits(hits)
746-
747769
with DatabaseConnection(
748770
self.conn_dic, self.table, properties=self.properties
749771
) as db:
@@ -855,7 +877,6 @@ def query(
855877

856878
# Generate feature JSON
857879
features = [self._response_feature(rd) for rd in row_data]
858-
# GA customisation - "numberMatched": hits, (pagination)
859880
feature_collection = {
860881
"numberMatched": hits,
861882
"type": "FeatureCollection",
@@ -1359,4 +1380,4 @@ def _class_factory(
13591380
), f"class {class_name} should inherit from {super_cls.__name__}"
13601381
LOGGER.debug(f"initialising {class_name} with params {kwargs}")
13611382
obj = cls(**kwargs)
1362-
return obj
1383+
return obj

0 commit comments

Comments
 (0)