Skip to content

Commit

Permalink
PR updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gem-neo4j committed Feb 13, 2025
1 parent 97aca4d commit 758bf72
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions common/src/main/java/apoc/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -1364,20 +1364,16 @@ public static <T> T withBackOffRetries(Supplier<T> func, long initialTimeout, lo
return result;
}

/**
* A helper function to give the Pre-parser text that can be appended to a query to force it to be
* of a certain Cypher Version
* @param procedureCallContext the injectable context from the procedure framework
* @return Cypher Pre-parser for Cypher Version setting
*/
public static String getCypherVersionPrefix(ProcedureCallContext procedureCallContext) {
return procedureCallContext.calledwithQueryLanguage().equals(QueryLanguage.CYPHER_5)
? "CYPHER 5 "
: "CYPHER 25 ";
}

public static String getCypherVersionString(ProcedureCallContext procedureCallContext) {
return procedureCallContext.calledwithQueryLanguage().equals(QueryLanguage.CYPHER_5) ? "5" : "25";
if (procedureCallContext.calledwithQueryLanguage().equals(QueryLanguage.CYPHER_5)) {
return "5";
} else if (procedureCallContext.calledwithQueryLanguage().equals(QueryLanguage.CYPHER_25)) {
return "25";
} else {
// When a new version of Cypher is added, please update here :)
throw new RuntimeException(
"Unsupported cypher query language: " + procedureCallContext.calledwithQueryLanguage());
}
}

private static final Pattern CYPHER_VERSION_PATTERN =
Expand Down

0 comments on commit 758bf72

Please sign in to comment.