Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7548287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:39:37+00:00 2026-05-30T09:39:37+00:00

How can I distinguish function calls and field names using JSQLParser? For example, the

  • 0

How can I distinguish function calls and field names using JSQLParser?

For example, the query SELECT COUNT(*) FROM db.table parses COUNT(*) as a field name and not a function call.

What do I need to do to change the SQL parsing to show COUNT(*) as a function call?

Thanks,

Max

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:39:39+00:00Added an answer on May 30, 2026 at 9:39 am

    You do not have sample code, so the code below is based on my guessing that you want to show that the count(*) is actually a function call only.

    import java.io.StringReader;
    
    import net.sf.jsqlparser.JSQLParserException;
    import net.sf.jsqlparser.expression.Function;
    import net.sf.jsqlparser.parser.CCJSqlParserManager;
    import net.sf.jsqlparser.statement.select.PlainSelect;
    import net.sf.jsqlparser.statement.select.Select;
    import net.sf.jsqlparser.statement.select.SelectExpressionItem;
    
    public class MySQLParser
    {
        CCJSqlParserManager parserManager = new CCJSqlParserManager();
    
        public MySQLParser() throws JSQLParserException
        {
            String statement = "SELECT COUNT(*) FROM db.table1";
            PlainSelect plainSelect = (PlainSelect) ((Select) parserManager.parse(new StringReader(statement))).getSelectBody();        
            System.out.format("%s is function call? %s",
                    plainSelect.getSelectItems().get(0),
                    ((Function)((SelectExpressionItem) plainSelect.getSelectItems().get(0)).getExpression()).isAllColumns());
        }
        public static void main(String[] args) throws JSQLParserException
        {
    
            new MySQLParser();
    
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a toy compiler thingy which can optimise function calls if the result
Can I distinguish signal, between delivered directly to a process and delivered via debugger.
I can not distinguish the difference between aggregating and holding. What does it mean
There seems to be a bug in the Java varargs implementation. Java can't distinguish
I'm trying to find a CSS selector that can help me distinguish between the
How can I get C# to distinguish between ambiguous class types without having to
I'm using the __get() and __set() magic methods in order to intercept external calls
If I have a function template with typename T , where the compiler can
I need to know which gtktreeview was passed to a function from the handler
I'm creating similar thing to twitter retweet function! This is my database table for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.