You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Does net.sf.jsqlparser.statement.Statement thread safe? #1627
You can certainly cache Statements if you are in a situation when you would have to parse similar, but very complex statements many times. Although I have a hard time to construe such a situation.
The more interesting challenge was to decide when a statement is equal. It would depend on a reliable hash of the SQL String -- after replacing any fixed Values (String, Boolean, Double, Long, Date) with parameters.
Determining this hash would depend on parsing the statement -- defeating the purpose.
Long story short: you can cache statements but I wonder why you would want to do that. Maybe you will need to elaborate on the exact challenge you want to overcome.
Activity
manticore-projects commentedon Sep 12, 2022
Greetings.
You can certainly cache Statements if you are in a situation when you would have to parse similar, but very complex statements many times. Although I have a hard time to construe such a situation.
The more interesting challenge was to decide when a statement is equal. It would depend on a reliable hash of the SQL String -- after replacing any fixed Values (String, Boolean, Double, Long, Date) with parameters.
Determining this hash would depend on parsing the statement -- defeating the purpose.
Long story short: you can cache statements but I wonder why you would want to do that. Maybe you will need to elaborate on the exact challenge you want to overcome.
Cheers.