SQL Translator

Background

By using SQL translator in the form of Java API, you can easily integrate into various systems and flexibly customize user requirements.

Parameters

Class: org.apache.shardingsphere.sqltranslator.api.config.SQLTranslatorRuleConfiguration

Attributes:

nameDataTypeDescription
typeStringSQL translator type
useOriginalSQLWhenTranslatingFailed (?)booleanWhether use original SQL when translating failed

Procedure

  1. Set SQL translator type.
  2. Set useOriginalSQLWhenTranslatingFailed to decide whether use original SQL when translating failed.

Sample

  1. SQLTranslatorRuleConfiguration ruleConfig = new SQLTranslatorRuleConfiguration("Native", new Properties(), false);
  2. String translatedSQL = new SQLTranslatorRule(ruleConfig).translate();