Questions tagged [jsqlparser]

JSqlParser is a SQL statement parser. It translates SQLs in a traversable hierarchy of Java classes.

About

JSqlParser is a SQL statement parser. It translates SQLs in a traversable hierarchy of Java classes.

JSqlParser is not limited to one database but provides support for a lot of specials of Oracle, SqlServer, MySQL, PostgreSQL ...

To name some, it has support for Oracles join syntax using (+), PostgreSQLs cast syntax using ::, relational operators like != and so on.

Links

60 questions
0
votes
0 answers

JSQLProcessor - retrieving table names with Join columns

I am using jsqlprocessor 4.6 for SQL query parsing. com.github.jsqlparser jsqlparser
user1578872
  • 7,808
  • 29
  • 108
  • 206
0
votes
0 answers

AWS Glue catalogPartitionPredicate : to_date is not working

I am planning to utilize catalogPartitionPredicate in one of my projects. I am unable to handle one of the scenarios. Below are the details: Partition columns: Year,Month & Day catalogPartitionPredicate: year>='2021' and month>='12' If the year…
Nabeel Khan Ghauri
  • 125
  • 1
  • 4
  • 15
0
votes
0 answers

Convert where clause(String) to Predicate(CriteriaQuery)

is there a way to convert a where clause to a CriteriaQuery Predicate Object? I'm looking into JSqlParser to parse a where clause, but before I start trying it myself I wonder if there is already a simple solution out there.
user2071938
  • 2,055
  • 6
  • 28
  • 60
0
votes
0 answers

get PG sql funnctions name from given query

our goal is to get pg sql inbuilt functions present in a query given by an user. TablesNamesFinder tablesNamesFinder = new TablesNamesFinder(){ @Override public void visit(Function function) { …
Mohamed
  • 3
  • 2
0
votes
0 answers

java.io.NotSerializableException: Custom JSQL Parser Implementation

I have a Flink application where I run a custom SQL parser and parse the SQL provided by user. This generates a Predicate tree which gets evaluated once the streaming application starts. I use JSQL parser to parse the SQL. When running the…
guru
  • 409
  • 4
  • 21
0
votes
1 answer

JsqlParser how to rewrite a expression

I have a sql where cluase: a > 1 and b < 1 and c = 3 In this case I want to remove the a>1, how could I rewrite it to 1 = 1 and b < 1 and c =3 I have try the ExpressionVisitor, but couldn't rewrite the Expression
Linyy
  • 23
  • 6
0
votes
0 answers

Is there any substitute for Postgres ALL Operator?

I'm trying to execute this: SELECT id, title FROM book WHERE author_id != all('{ {d778ee4f-e7cf-436e-8975-8f6ca2cccb2a}, {17db25c6-0d61-4f23-826e-4f2982bcc490} }'::uuid[]); This select SQL works perfectly in Postgres but,…
rcorrent
  • 11
  • 5
0
votes
1 answer

JSQLParser gel all select items from query and subquery

I want to get all the select items from query and subquery as per this link, https://stackoverflow.com/a/30505741/8249665 I can get select items from the main query. For subquery like this- "SELECT * FROM CUSTOMERS WHERE ID IN (SELECT ID FROM…
was_777
  • 599
  • 1
  • 9
  • 28
0
votes
3 answers

How to use JSQL Parser to retrieve table names from a query?

I started to write code to parse a SQL query only to find out that there are APIs available for the same. When I saw JSQLParser here, downloaded the jar using the given dependency com.github.jsqlparser
Metadata
  • 2,127
  • 9
  • 56
  • 127
0
votes
1 answer

JSQL Parser - info on dblink

I m using JSQLPARSER for the first time and I wonder if it s possible to detect remote links (oracle dblink)? If for example a simple select * from table1@remote
BabeteOne
  • 37
  • 3
0
votes
0 answers

JSqlparser throw exception when statement contains lateral view

Goal: To parse sql statement like : select id, name, lateral view explode(info) from info_table; Current status: JSqlParser will throw exception: ParseException:Encountered unexpected token: "lateral" "LATERAL" at line 1.
AI Joes
  • 69
  • 11
0
votes
1 answer

Access array element use JSqlParser

I insert this sql into JSqlParser: select count(distinct case when split(vir_name,"\\/")[OFFSET(0)] in ("G-Ware","RiskWare","Tool","PornWare","Trojan") then apk_name else null end) as black_apk_n from table1 and get error: Caused by:…
Jeremy Len
  • 99
  • 1
  • 12
0
votes
0 answers

JSqlParser will throw exception when udf function is not defined

I am using JSqlParser to do some simple table name modification, but it will throw exception when I use some udf functions in statements. How to make it ignore function check? def replaceTableName(sql: String) = { val select =…
Jeremy Len
  • 99
  • 1
  • 12
0
votes
1 answer

Java Util SQL Parser throws an exception for a correct statement

My statement is new_call.cdctype=goal.cdctype When I call the method CCJSqlParser.SQLCondition() on this, I get an exception saying Encountered " "=" "= "" at line 1, column 17. Was expecting one of: "NOT" ... "LIKE" ... "ILIKE" ... …
0
votes
2 answers

Replace multi appearance in sql statement using jsqlparser

I am using jsqlparser to parse a SQL string and replace table names in the string. My input is SELECT id, test FROM test1 JOIN test2 ON test1.aa = test2.bb WHERE test1.conf = \"test\" LIMIT 10" and my goal output is SELECT id, test…
Jeremy Len
  • 99
  • 1
  • 12