本文整理汇总了Java中com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser类的典型用法代码示例。如果您正苦于以下问题:Java OracleStatementParser类的具体用法?Java OracleStatementParser怎么用?Java OracleStatementParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OracleStatementParser类属于com.alibaba.druid.sql.dialect.oracle.parser包,在下文中一共展示了OracleStatementParser类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: statementParse
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser; //导入依赖的package包/类
@Override
public void statementParse(SchemaConfig schema, RouteResultset rrs, SQLStatement stmt) {
SQLSelectStatement selectStmt = (SQLSelectStatement)stmt;
SQLSelectQuery sqlSelectQuery = selectStmt.getSelect().getQuery();
//从mysql解析过来
if(sqlSelectQuery instanceof MySqlSelectQueryBlock) {
MySqlSelectQueryBlock mysqlSelectQuery = (MySqlSelectQueryBlock)selectStmt.getSelect().getQuery();
Limit limit=mysqlSelectQuery.getLimit();
if(limit==null)
{
//使用oracle的解析,否则会有部分oracle语法识别错误
OracleStatementParser oracleParser = new OracleStatementParser(getCtx().getSql());
SQLSelectStatement oracleStmt = (SQLSelectStatement) oracleParser.parseStatement();
selectStmt= oracleStmt;
SQLSelectQuery oracleSqlSelectQuery = oracleStmt.getSelect().getQuery();
if(oracleSqlSelectQuery instanceof OracleSelectQueryBlock)
{
parseNativePageSql(oracleStmt, rrs, (OracleSelectQueryBlock) oracleSqlSelectQuery, schema);
}
}
if(isNeedParseOrderAgg)
{
parseOrderAggGroupMysql(schema, selectStmt,rrs, mysqlSelectQuery);
//更改canRunInReadDB属性
if ((mysqlSelectQuery.isForUpdate() || mysqlSelectQuery.isLockInShareMode()) && rrs.isAutocommit() == false)
{
rrs.setCanRunInReadDB(false);
}
}
}
}
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:38,代码来源:DruidSelectOracleParser.java
示例2: parseOneIdx
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser; //导入依赖的package包/类
private Map parseOneIdx(String idx)
{
Map map = new HashMap();
OracleStatementParser parser = new OracleStatementParser(idx);
OracleCreateIndexStatement statement = parser.parseCreateIndex(true);
SQLExprTableSource tableSource = (SQLExprTableSource) statement.getTable();
String tableName = ((SQLPropertyExpr) tableSource.getExpr()).getSimleName().toLowerCase();
String idxType = statement.getType();
List<SQLSelectOrderByItem> items = statement.getItems();
List fields = new ArrayList();
for (SQLSelectOrderByItem item : items)
{
SQLIdentifierExpr expr = (SQLIdentifierExpr) item.getExpr();
fields.add(expr.getSimleName().toLowerCase());
}
if ("unique".equalsIgnoreCase(idxType))
map.put(tableName, fields);
return map;
}
开发者ID:iisi-nj,项目名称:GemFireLite,代码行数:20,代码来源:OracleDdlParser.java
示例3: createSQLStatementParser
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser; //导入依赖的package包/类
public static SQLStatementParser createSQLStatementParser(String sql, String dbType, SQLParserFeature... features) {
if (JdbcConstants.ORACLE.equals(dbType) || JdbcConstants.ALI_ORACLE.equals(dbType)) {
return new OracleStatementParser(sql);
}
if (JdbcConstants.MYSQL.equals(dbType)) {
return new MySqlStatementParser(sql, features);
}
if (JdbcConstants.MARIADB.equals(dbType)) {
return new MySqlStatementParser(sql, features);
}
if (JdbcConstants.POSTGRESQL.equals(dbType)
|| JdbcConstants.ENTERPRISEDB.equals(dbType)) {
return new PGSQLStatementParser(sql);
}
if (JdbcConstants.SQL_SERVER.equals(dbType) || JdbcConstants.JTDS.equals(dbType)) {
return new SQLServerStatementParser(sql);
}
if (JdbcConstants.H2.equals(dbType)) {
return new H2StatementParser(sql);
}
if (JdbcConstants.DB2.equals(dbType)) {
return new DB2StatementParser(sql);
}
if (JdbcConstants.ODPS.equals(dbType)) {
return new OdpsStatementParser(sql);
}
if (JdbcConstants.PHOENIX.equals(dbType)) {
return new PhoenixStatementParser(sql);
}
if (JdbcConstants.HIVE.equals(dbType)) {
return new HiveStatementParser(sql);
}
if (JdbcConstants.ELASTIC_SEARCH.equals(dbType)) {
return new MySqlStatementParser(sql);
}
return new SQLStatementParser(sql, dbType);
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:49,代码来源:SQLParserUtils.java
示例4: parseSql
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser; //导入依赖的package包/类
private static SQLStatement parseSql(String sql) {
String convertSql = trimPattern.matcher(sql).replaceAll("xtrim");
SQLStatementParser parser = new OracleStatementParser(convertSql);
List<SQLStatement> stmtList;
try {
stmtList = parser.parseStatementList();
} catch (ParserException exception) {
exception.printStackTrace();
throw new RuntimeException(sql + " is invalid, detail " + exception.getMessage());
}
return stmtList.get(0);
}
开发者ID:bingoohuang,项目名称:javacode-demo,代码行数:14,代码来源:OracleSensitiveFieldsParser.java
示例5: getSQLStatementParser
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser; //导入依赖的package包/类
private static SQLStatementParser getSQLStatementParser(DatabaseType databaseType,final String sql) {
switch (databaseType) {
case MySQL:
return new MySqlStatementParser(sql);
case PostgreSQL:
return new PGSQLStatementParser(sql);
case Oracle:
return new OracleStatementParser(sql);
default:
throw new UnsupportedOperationException(String.format("Cannot support database type [%s]", databaseType));
}
}
开发者ID:balancebeam,项目名称:sherlock,代码行数:13,代码来源:SQLParserFactory.java
示例6: testDruidParser
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser; //导入依赖的package包/类
@Test
public void testDruidParser(){
String sql = "select t.rowid from (select col1,col2,col3 from person_table where age>12 and name='asss' and schoolId||'tomo'||schoolId =? order by item) t";
OracleStatementParser s=new OracleStatementParser(sql);
SQLSelectStatement select=s.parseSelect();
System.out.println(select);
}
开发者ID:GeeQuery,项目名称:ef-orm,代码行数:8,代码来源:SqlParserPerformaceTest.java
示例7: testTrimxResult
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser; //导入依赖的package包/类
@Test
public void testTrimxResult() {
SQLStatementParser parser = new OracleStatementParser(trimxSql);
parser.parseStatementList();
}
开发者ID:bingoohuang,项目名称:javacode-demo,代码行数:6,代码来源:OracleSensitiveFieldsParserTest.java
示例8: testTrimResultBug
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser; //导入依赖的package包/类
@Test//(expected = ParserException.class)
// ParserException: syntax error, expect FROM, actual RPAREN CERT_CHECK_RSP_CODE
public void testTrimResultBug() {
SQLStatementParser parser = new OracleStatementParser(trimSql);
parser.parseStatementList();
}
开发者ID:bingoohuang,项目名称:javacode-demo,代码行数:7,代码来源:OracleSensitiveFieldsParserTest.java
示例9: testInterval
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser; //导入依赖的package包/类
@Test
public void testInterval() throws Exception {
new OracleStatementParser(intervalSql).parseStatementList();
}
开发者ID:bingoohuang,项目名称:javacode-demo,代码行数:5,代码来源:OracleSensitiveFieldsParserTest.java
示例10: testFunction
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser; //导入依赖的package包/类
@Test(expected = Exception.class)
public void testFunction() {
OracleStatementParser parser = new OracleStatementParser("select upper(*) from aa order by now()");
SQLStatement st = parser.parseStatement();
System.out.println(st);
}
开发者ID:GeeQuery,项目名称:ef-orm,代码行数:7,代码来源:ComplexSqlParseTest.java
注:本文中的com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论