Package nzilbb.sql.mysql
Class MySQLTranslator
- java.lang.Object
-
- nzilbb.sql.mysql.MySQLTranslator
-
- All Implemented Interfaces:
Function<String,String>
,UnaryOperator<String>
- Direct Known Subclasses:
VanillaSQLTranslator
public class MySQLTranslator extends Object implements UnaryOperator<String>
Object that translates statements designed for MySQL's flavour of SQL to the flavour used by the graph service.Where necessary for performance or functionality, annotators may need to use features of SQL that are specific to MySQL, e.g. specifying the ENGINE when creating tables, using the
utf8mb4
CHARACTER SET etc.For implementations that don't use MySQL (e.g. for local command-line annatotator processing), this class provides the possibility of intercepting SQL statements and converting them into variants that will work with whatever RDBMS has been chosen. Other implementations migth simply strip out unsupported syntax, or may convert operators or functions to equivalants.
The default implementation simply passes statements through unchanged.
- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Constructor Summary
Constructors Constructor Description MySQLTranslator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
apply(String sql)
Translate the given statement.String
getRdbms()
Getter forrdbms
: Name of the Relational Database Management System the translator is for.boolean
getTrace()
Getter fortrace
: Whether to print statements passed toapply(String)
MySQLTranslator
setTrace(boolean newTrace)
Setter fortrace
: Whether to print statements passed toapply(String)
-
-
-
Method Detail
-
getRdbms
public String getRdbms()
Getter forrdbms
: Name of the Relational Database Management System the translator is for.- Returns:
- Name of the Relational Database Management System the translator is for.
-
getTrace
public boolean getTrace()
Getter fortrace
: Whether to print statements passed toapply(String)
- Returns:
- Whether to print statements passed to
apply(String)
-
setTrace
public MySQLTranslator setTrace(boolean newTrace)
Setter fortrace
: Whether to print statements passed toapply(String)
- Parameters:
newTrace
- Whether to print statements passed toapply(String)
-
-