public class SchemaDumper extends Object
Constructor and Description |
---|
SchemaDumper()
Instantiate SchemaDumper.
|
SchemaDumper(MySqlConnectionInfo localMySqlConnectionInfo)
Instantiate SchemaDumper.
|
SchemaDumper(MySqlConnectionInfo localMySqlConnectionInfo,
String mysqldumpPath)
Instantiate SchemaDumper.
|
SchemaDumper(String mysqldumpPath)
Instantiate SchemaDumper.
|
Modifier and Type | Method and Description |
---|---|
String |
dump(File sqlFile)
Dump schema from SQL file which is written by UTF-8.
|
String |
dump(File sqlFile,
Charset charset)
Dump schema from SQL file.
|
String |
dump(String sql)
Dump schema from SQL string.
|
String |
dumpFromLocalDb(String dbName)
Dump schema from DB name which is in local MySQL.
|
String |
dumpFromRemoteDb(String dbName,
MySqlConnectionInfo mysqlConnectionInfo)
Dump schema from DB name which is in remote MySQL.
|
public SchemaDumper(MySqlConnectionInfo localMySqlConnectionInfo, String mysqldumpPath)
localMySqlConnectionInfo
- Connection information of MySQL which is on your local
environment.mysqldumpPath
- Path for mysqldump command.public SchemaDumper(MySqlConnectionInfo localMySqlConnectionInfo)
Path of mysqldump will be used default as "mysqldump".
localMySqlConnectionInfo
- Connection information of MySQL which is on your local
environment.public SchemaDumper(String mysqldumpPath)
Connection information of local MySQL will be used default as "-h localhost -u root".
mysqldumpPath
- Path for mysqldump command.public SchemaDumper()
Path of mysqldump will be used default as "mysqldump".
Connection information of local MySQL will be used default as "-h localhost -u root".
public String dump(String sql) throws SQLException, IOException, InterruptedException
sql
- SQL string which is a target to dump.SQLException
- Throw if invalid SQL is given.IOException
- Throw if mysqldump command is failed.InterruptedException
- Throw if mysqldump command is failed.public String dump(File sqlFile, Charset charset) throws IOException, SQLException, InterruptedException
sqlFile
- SQL file.charset
- Character set of SQL file.SQLException
- Throw if invalid SQL is given.IOException
- Throw if mysqldump command is failed.InterruptedException
- Throw if mysqldump command is failed.public String dump(File sqlFile) throws IOException, SQLException, InterruptedException
sqlFile
- SQL file (written by UTF-8).SQLException
- Throw if invalid SQL is given.IOException
- Throw if mysqldump command is failed.InterruptedException
- Throw if mysqldump command is failed.public String dumpFromLocalDb(String dbName) throws IOException, InterruptedException, SQLException
dbName
- DB name which is in local MySQL.SQLException
- Throw if invalid SQL is given.IOException
- Throw if mysqldump command is failed.InterruptedException
- Throw if mysqldump command is failed.public String dumpFromRemoteDb(String dbName, MySqlConnectionInfo mysqlConnectionInfo) throws IOException, InterruptedException, SQLException
dbName
- DB name which is in remote MySQL.mysqlConnectionInfo
- Connection information of remote MySQL.SQLException
- Throw if invalid SQL is given.IOException
- Throw if mysqldump command is failed.InterruptedException
- Throw if mysqldump command is failed.Copyright © 2020. All rights reserved.