by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Tobias
    @wumpz
    @Douglas_MA_twitter JSqlparser is based on a strict Javacc grammar. I introduced some error fallbacks to skip bad statements but this cannot be extended to your suggestion AFAIK.
    @
    @nisainana this syntax is not supported. Can you switch to case when?
    nisainana
    @nisainana
    @wumpz thanks
    Fabian Bull
    @peri4n
    @wumpz thx
    Douglas Moore
    @Douglas_MA_twitter
    @wumpz Thanks... For what it's worth... I learned of some text mining techniques to help find dependencies ... I'll see how that plays out as a fallback.
    jjlin
    @jjlin
    are there javadocs generated for this project?
    but nothing "official"?
    Tobias
    @wumpz
    The javadoc are deployed at maven central. But there is no link from GitHub. Which is an inconvenience.
    xpanda17
    @xpanda17
    Hi, I wanna know about how to access the hierarchy from parsed SQL query. For instance, I can get the table names with TablesNamesFinder and I'd like to get the select column names, where clause, order by clause, etc. Or am I looking at the wrong library? Thanks sir
    Tobias
    @wumpz
    @xpanda17 No, that is absolutely possible.
    You don't have to write a visitor. A direct object access would be sufficient.
    Look at the examples or the many select tests. You could also file an issue.
    xpanda17
    @xpanda17

    @wumpz where can I find the example sir? I believe I have look onto the wiki and run this code
    "Statement stmt = CCJSqlParserUtil.parse("SELECT * FROM tab1");"

    but stmt doesnt have any methods that return parsed name (?). Sorry sir I am noob :D

    xpanda17
    @xpanda17
    I think I found it, it would be nice if there is documentation. Thank you sir, nice library!
    Jan Monterrubio
    @AnEmortalKid
    You probably wanna implement your own visitor
    That will let’s you explore the tree
    xpanda17
    @xpanda17

    @AnEmortalKid any reading material? something like user guide for this? I'm kinda overwhelmed actually because there are so many features hahaha

    @wumpz btw sir, I got a bit problem for example in query like "select avg(a), b from table1;". I know I can get the "avg(a)" and "b". While avg(a) should be casted to Function and b casted to Column. Is there any way to know whats it type (function or column) from SelectExpressionItem class. Well actually I can check it manually using regex, but I guess this library already has the function to do this but I can't find it. And is there any official docs or user guide for this library other than the git wiki? Thanks alot!

    Tobias
    @wumpz
    What you are looking is the visitor pattern. There you get the already right typed expressions. Unfortunately there is only this wiki and docs. I had never the time and energy to write one. But if you want to provide one or a part like a quick start guide, go ahead. Cheers Tobias
    Mm
    Jan Monterrubio
    @AnEmortalKid

    Unfortunately, anything I could provide you is proprietary to the company I work for.

    any user guide?

    No. I guess I can try to write one while pubg is down. What are you trying to do or achieve? It's just the visitor pattern.

    xpanda17
    @xpanda17
    @AnEmortalKid @wumpz just quick question sir, where is the impl of accept method? I'd like to read about it
    Jan Monterrubio
    @AnEmortalKid
    You implement it. Basically you'd have something like:
    class Whatever {
     main(String[] args) {
     String sql = "Select * from TAB1";
    StatementVisitor vs = new MyVisitor();
    vs.accept(CCSQlutilParser.parse(sql));
    }
    
    
    class MyVisitor implements StatementVisitor
     // other methods ommitted
    visit(Select select) {
    
    SelectBody sb = select.getBody();
    System.out.println("SB:" + sb);
    visit(sb);
    }
    visit(SelectBody sb) {
    // do something with whatever, call visit if it's another element type
    }
    }
    }
    }
    Your visitor starts with the top most elements (Select/Update/Insert/DDL/Delete) and then you recursively call the underlying children
    here's one
    xpanda17
    @xpanda17
    alright thanks alot mate
    Jan Monterrubio
    @AnEmortalKid
    mhmmm. if that doesn't make sense let us nkow :)
    Tobias
    @wumpz
    Noml
    bagopalan
    @bagopalan
    Hi, I am trying to get all table names from the parser. But our sql is little different where our table names will have catalog.hive.horton.db.tablename .
    val selectItem = CCJSqlParserUtil.parse(mysql)
    new CCJSqlParser(new StringProvider(mysql))
    val list1 = finder.getTableList(selectItem.asInstanceOf[net.sf.jsqlparser.statement.select.Select])
    I am able to get all the table names using the above code, if I have four dots in the table names.
    But it fails as we have 5 dots
    it works if it is hive.horton.db.tablename
    but fails if the table name is catalog.hive.horton.db.tablename
    get parse exception
    Tobias
    @wumpz
    I assume you do not use the latest version. Before there was a limitation of those multipart names. If the problem remains, file an issue. Cheers Tobias
    Shivraj Sinhg
    @Shiv1791
    Hi, please help me with it:
    Can I parse all the Greenplum SQL queries using JSQLParser? if yes then how.
    Tobias
    @wumpz
    You know, JSqlParser is a multi database sql parser. Therefore it is not limited to one database. However, the development is feature driven. If there is need for a new syntactical construct, it will be implemented, prioritized by the motivation the developer has :).
    @Shiv1791 So give me some SQLs, that are not parseable and I will look into it.
    Shivraj Sinhg
    @Shiv1791
    CREATE TABLE baby.rank (id int, rank int, year smallint,
    gender char(1), count int ) DISTRIBUTED BY (rank, gender,
    year);
    Tobias
    @wumpz
    This distributed thing is not yet supported. Create an issue for this with the JSqlparser exception. Cheers Tobias
    Shivraj Sinhg
    @Shiv1791
    Thanks. I'll do that
    Mukul Budania
    @mukulkbudania
    Hi All
    I keep getting compilation issues.
    src/main/java/net/sf/jsqlparser/parser/ASTNodeAccessImpl.java:14: error: cannot find symbol
    [javac] private SimpleNode node;
    And 60 more. Am I missing something?
    Jan Monterrubio
    @AnEmortalKid
    Are you trying to contribute/compile the sources? I usually use maven first before importing to an IDE
    Tobias
    @wumpz
    Or use an IDE that supports maven directly.
    Jan Monterrubio
    @AnEmortalKid
    ^ that, I recommend IntelliJ (eclipse used to need an m2e plugin, no idea how it does these days)
    Pavel Bekkerman
    @wheredevel
    Eclipse>Market Place>Search for Maven...