From f11022d880faf9c95b6b19c6a6d0596f197dfbce Mon Sep 17 00:00:00 2001
From: malakaganga <malakaganga.ac@gmail.com>
Date: Fri, 1 Mar 2024 12:31:13 +0530
Subject: [PATCH] Fix SqlQuery type mismatching issue

We have used a static variable to keep Sql Query type hence when more than one DataServices is deployed the query type becomes inconsistent. Fix this by removing the static context.

Fixes: https://github.com/wso2/api-manager/issues/2520
---
 .../dataservices/core/description/query/SQLQuery.java         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/SQLQuery.java b/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/SQLQuery.java
index c5c0f0c2d2..2920715f16 100644
--- a/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/SQLQuery.java
+++ b/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/description/query/SQLQuery.java
@@ -151,7 +151,7 @@ public class SQLQuery extends ExpressionQuery implements BatchRequestParticipant
 
     private boolean timeConvertEnabled = true;
 
-    private static QueryType sqlQueryType;
+    private QueryType sqlQueryType;
 
     /**
      * thread local variable to keep the ordinal of the ref cursor if there is any
@@ -2571,7 +2571,7 @@ public QueryType setSqlQueryType(String query) {
         return sqlQueryType = sqlQueryType(query);
     }
 
-    public static QueryType sqlQueryType(String sqlQuery) {
+    public QueryType sqlQueryType(String sqlQuery) {
 
         String query;
         try {