Search in sources :

Example 1 with NotSupportYetException

use of io.seata.common.exception.NotSupportYetException in project seata by seata.

the class MySQLDeleteRecognizer method getTableName.

@Override
public String getTableName() {
    StringBuilder sb = new StringBuilder();
    MySqlOutputVisitor visitor = new MySqlOutputVisitor(sb) {

        @Override
        public boolean visit(SQLExprTableSource x) {
            printTableSourceExpr(x.getExpr());
            return false;
        }

        @Override
        public boolean visit(SQLJoinTableSource x) {
            throw new NotSupportYetException("not support the syntax of delete with join table");
        }
    };
    SQLTableSource tableSource;
    if (ast.getFrom() == null) {
        tableSource = ast.getTableSource();
    } else {
        tableSource = ast.getFrom();
    }
    if (tableSource instanceof SQLExprTableSource) {
        visitor.visit((SQLExprTableSource) tableSource);
    } else if (tableSource instanceof SQLJoinTableSource) {
        visitor.visit((SQLJoinTableSource) tableSource);
    } else {
        throw new NotSupportYetException("not support the syntax of delete with unknow");
    }
    return sb.toString();
}
Also used : MySqlOutputVisitor(com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor) SQLExprTableSource(com.alibaba.druid.sql.ast.statement.SQLExprTableSource) SQLJoinTableSource(com.alibaba.druid.sql.ast.statement.SQLJoinTableSource) NotSupportYetException(io.seata.common.exception.NotSupportYetException) SQLTableSource(com.alibaba.druid.sql.ast.statement.SQLTableSource)

Example 2 with NotSupportYetException

use of io.seata.common.exception.NotSupportYetException in project seata by seata.

the class MySQLUpdateRecognizer method getTableName.

@Override
public String getTableName() {
    StringBuilder sb = new StringBuilder();
    MySqlOutputVisitor visitor = new MySqlOutputVisitor(sb) {

        @Override
        public boolean visit(SQLExprTableSource x) {
            printTableSourceExpr(x.getExpr());
            return false;
        }

        @Override
        public boolean visit(SQLJoinTableSource x) {
            throw new NotSupportYetException("not support the syntax of update with join table");
        }
    };
    SQLTableSource tableSource = ast.getTableSource();
    if (tableSource instanceof SQLExprTableSource) {
        visitor.visit((SQLExprTableSource) tableSource);
    } else if (tableSource instanceof SQLJoinTableSource) {
        visitor.visit((SQLJoinTableSource) tableSource);
    } else {
        throw new NotSupportYetException("not support the syntax of update with unknow");
    }
    return sb.toString();
}
Also used : MySqlOutputVisitor(com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor) SQLExprTableSource(com.alibaba.druid.sql.ast.statement.SQLExprTableSource) SQLJoinTableSource(com.alibaba.druid.sql.ast.statement.SQLJoinTableSource) NotSupportYetException(io.seata.common.exception.NotSupportYetException) SQLTableSource(com.alibaba.druid.sql.ast.statement.SQLTableSource)

Example 3 with NotSupportYetException

use of io.seata.common.exception.NotSupportYetException in project seata by seata.

the class OracleDeleteRecognizer method getTableName.

@Override
public String getTableName() {
    StringBuilder sb = new StringBuilder();
    OracleOutputVisitor visitor = new OracleOutputVisitor(sb) {

        @Override
        public boolean visit(SQLExprTableSource x) {
            printTableSourceExpr(x.getExpr());
            return false;
        }

        @Override
        public boolean visit(SQLJoinTableSource x) {
            throw new NotSupportYetException("not support the syntax of delete with join table");
        }
    };
    SQLTableSource tableSource;
    if (ast.getFrom() == null) {
        tableSource = ast.getTableSource();
    } else {
        tableSource = ast.getFrom();
    }
    if (tableSource instanceof SQLExprTableSource) {
        visitor.visit((SQLExprTableSource) tableSource);
    } else if (tableSource instanceof SQLJoinTableSource) {
        visitor.visit((SQLJoinTableSource) tableSource);
    } else {
        throw new NotSupportYetException("not support the syntax of delete with unknow");
    }
    return sb.toString();
}
Also used : OracleOutputVisitor(com.alibaba.druid.sql.dialect.oracle.visitor.OracleOutputVisitor) SQLExprTableSource(com.alibaba.druid.sql.ast.statement.SQLExprTableSource) SQLJoinTableSource(com.alibaba.druid.sql.ast.statement.SQLJoinTableSource) NotSupportYetException(io.seata.common.exception.NotSupportYetException) SQLTableSource(com.alibaba.druid.sql.ast.statement.SQLTableSource)

Example 4 with NotSupportYetException

use of io.seata.common.exception.NotSupportYetException in project seata by seata.

the class OracleUpdateRecognizer method getTableName.

@Override
public String getTableName() {
    StringBuilder sb = new StringBuilder();
    OracleOutputVisitor visitor = new OracleOutputVisitor(sb) {

        @Override
        public boolean visit(SQLExprTableSource x) {
            printTableSourceExpr(x.getExpr());
            return false;
        }

        @Override
        public boolean visit(SQLJoinTableSource x) {
            throw new NotSupportYetException("not support the syntax of update with join table");
        }
    };
    SQLTableSource tableSource = ast.getTableSource();
    if (tableSource instanceof SQLExprTableSource) {
        visitor.visit((SQLExprTableSource) tableSource);
    } else if (tableSource instanceof SQLJoinTableSource) {
        visitor.visit((SQLJoinTableSource) tableSource);
    } else {
        throw new NotSupportYetException("not support the syntax of update with unknow");
    }
    return sb.toString();
}
Also used : OracleOutputVisitor(com.alibaba.druid.sql.dialect.oracle.visitor.OracleOutputVisitor) SQLExprTableSource(com.alibaba.druid.sql.ast.statement.SQLExprTableSource) SQLJoinTableSource(com.alibaba.druid.sql.ast.statement.SQLJoinTableSource) NotSupportYetException(io.seata.common.exception.NotSupportYetException) SQLTableSource(com.alibaba.druid.sql.ast.statement.SQLTableSource)

Example 5 with NotSupportYetException

use of io.seata.common.exception.NotSupportYetException in project seata by seata.

the class PostgresqlDeleteRecognizer method getTableName.

@Override
public String getTableName() {
    StringBuilder sb = new StringBuilder();
    PGOutputVisitor visitor = new PGOutputVisitor(sb) {

        @Override
        public boolean visit(SQLExprTableSource x) {
            printTableSourceExpr(x.getExpr());
            return false;
        }

        @Override
        public boolean visit(SQLJoinTableSource x) {
            throw new NotSupportYetException("not support the syntax of delete with join table");
        }
    };
    SQLTableSource tableSource;
    if (ast.getFrom() == null) {
        tableSource = ast.getTableSource();
    } else {
        tableSource = ast.getFrom();
    }
    if (tableSource instanceof SQLExprTableSource) {
        visitor.visit((SQLExprTableSource) tableSource);
    } else if (tableSource instanceof SQLJoinTableSource) {
        visitor.visit((SQLJoinTableSource) tableSource);
    } else {
        throw new NotSupportYetException("not support the syntax of delete with unknow");
    }
    return sb.toString();
}
Also used : PGOutputVisitor(com.alibaba.druid.sql.dialect.postgresql.visitor.PGOutputVisitor) SQLExprTableSource(com.alibaba.druid.sql.ast.statement.SQLExprTableSource) SQLJoinTableSource(com.alibaba.druid.sql.ast.statement.SQLJoinTableSource) NotSupportYetException(io.seata.common.exception.NotSupportYetException) SQLTableSource(com.alibaba.druid.sql.ast.statement.SQLTableSource)

Aggregations

NotSupportYetException (io.seata.common.exception.NotSupportYetException)16 SQLExprTableSource (com.alibaba.druid.sql.ast.statement.SQLExprTableSource)6 SQLJoinTableSource (com.alibaba.druid.sql.ast.statement.SQLJoinTableSource)6 SQLTableSource (com.alibaba.druid.sql.ast.statement.SQLTableSource)6 ArrayList (java.util.ArrayList)4 List (java.util.List)3 MySqlOutputVisitor (com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor)2 OracleOutputVisitor (com.alibaba.druid.sql.dialect.oracle.visitor.OracleOutputVisitor)2 PGOutputVisitor (com.alibaba.druid.sql.dialect.postgresql.visitor.PGOutputVisitor)2 TableMeta (io.seata.rm.datasource.sql.struct.TableMeta)2 ParametersHolder (io.seata.sqlparser.ParametersHolder)2 SQLRecognizer (io.seata.sqlparser.SQLRecognizer)2 Field (java.lang.reflect.Field)2 ResultSet (java.sql.ResultSet)2 SQLException (java.sql.SQLException)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 StringJoiner (java.util.StringJoiner)2 ShouldNeverHappenException (io.seata.common.exception.ShouldNeverHappenException)1 PreparedStatementProxy (io.seata.rm.datasource.PreparedStatementProxy)1