GeezerVison is showing github.com — How to parse CREATE DATABASE DATABASE_NAME ? · Issue #2070 · JSQLParser/JSqlParser
How to parse CREATE DATABASE DATABASE_NAME ? #2070
Description
package org.example;
import net.sf.jsqlparser.parser.CCJSqlParser;
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.Statements;
class Main {
public static void main(String[] args) {
try {
String sqlStr = "CREATE DATABASE USERS; ";
Statement statement=CCJSqlParserUtil.parse(sqlStr);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
Activity
manticore-projects commented on Sep 6, 2024
I just double checked that Grammar: there is indeed no support yet for CREATE DATABASE ...
PRs are welcome.
ganesh-akashh commented on Sep 9, 2024
Can you share a user guide on how to introduce new features ?
manticore-projects commented on Sep 9, 2024
fudianchn commented on Aug 15, 2026
PR #2471 adds a typed CreateDatabase statement: CREATE DATABASE [IF NOT EXISTS] <name> parses into CreateDatabase (with getDatabaseName()), and vendor-specific options after the name such as MySQL's DEFAULT CHARACTER SET utf8mb4 are captured verbatim and round-trip unchanged.
Metadata
Metadata
Development
No branches or pull requestsIssue actions