com.parmet:mysql2h2-parser

A library to convert MySQL statements to H2-compatible statements

License

License

Categories

Categories

MySQL Data Databases H2
GroupId

GroupId

com.parmet
ArtifactId

ArtifactId

mysql2h2-parser
Last Version

Last Version

0.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

A library to convert MySQL statements to H2-compatible statements

Download mysql2h2-parser

How to add to project

<!-- https://jarcasting.com/artifacts/com.parmet/mysql2h2-parser/ -->
<dependency>
    <groupId>com.parmet</groupId>
    <artifactId>mysql2h2-parser</artifactId>
    <version>0.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.parmet/mysql2h2-parser/
implementation 'com.parmet:mysql2h2-parser:0.2.1'
// https://jarcasting.com/artifacts/com.parmet/mysql2h2-parser/
implementation ("com.parmet:mysql2h2-parser:0.2.1")
'com.parmet:mysql2h2-parser:jar:0.2.1'
<dependency org="com.parmet" name="mysql2h2-parser" rev="0.2.1">
  <artifact name="mysql2h2-parser" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.parmet', module='mysql2h2-parser', version='0.2.1')
)
libraryDependencies += "com.parmet" % "mysql2h2-parser" % "0.2.1"
[com.parmet/mysql2h2-parser "0.2.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.apache.logging.log4j : log4j-core jar 2.8.2

test (1)

Group / Artifact Type Version
junit : junit jar 4.8.1

Project Modules

There are no modules declared in this project.

mysql2h2-converter

A MySQL to H2 SQL conversion library written in Java.

Parse a MySQL dump and convert it to H2 statements either as an embedded library or as a standalone tool.

Next steps can include:

Other ideas:

Usage

As a library:

private static void convertAndCreate(Statement stmt, String sqlDump) throws SQLException, ParseException {
    Iterator<SqlStatement> sourceIterator = SQLParserManager.parseScript(new StringReader(sqlDump));
    Iterator<SqlStatement> converted = H2Converter.convertScript(sourceIterator);
    while (converted.hasNext()) {
        stmt.execute(converted.next().toString());
    }
}

On the command line:

java -jar lib/mysql2h2.jar demos/disconf-mysql.sql

Building

mvn install will generate the SQL parser and build an executable JAR.

License

This code is provided under the MIT license.

Versions

Version
0.2.1
0.2.0