当前位置: 首页>>代码示例>>Java>>正文


Java Table.setName方法代码示例

本文整理汇总了Java中net.sf.jsqlparser.schema.Table.setName方法的典型用法代码示例。如果您正苦于以下问题:Java Table.setName方法的具体用法?Java Table.setName怎么用?Java Table.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.jsqlparser.schema.Table的用法示例。


在下文中一共展示了Table.setName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import net.sf.jsqlparser.schema.Table; //导入方法依赖的package包/类
@Override
public void visit(Table tableName) {
    if (tableName == null) {
        return;
    }
    String name = tableName.getName();
    if (name != null) {
        tableName.setName(CompatibilityUtils.fixMySqlName(name.toLowerCase()));
    }
    Alias alias = tableName.getAlias();
    if (alias != null) {
        String aliasName = alias.getName();
        if (aliasName != null) {
            alias.setName(CompatibilityUtils.fixMySqlName(aliasName.toLowerCase()));
        }
    }
}
 
开发者ID:diennea,项目名称:herddb,代码行数:18,代码来源:JdbcQueryRewriter.java

示例2: visit

import net.sf.jsqlparser.schema.Table; //导入方法依赖的package包/类
@Override
public void visit(Table table) {
    String alias = table.getAlias().getName();
    ServerTable t = selectParser.getSelectDef().getServerTable(alias);
    
    try {
        
        UpdateParamParser paramParser = new UpdateParamParser(alias, t);
        Select select = t.getSelect();
        select.getSelectBody().accept(paramParser);
        
        table.setSchemaName(null);
        table.setName("(" + select.toString() + ")");
        
        parameters.putAll(paramParser.getParameters());
        
    } catch (JSQLParserException ex) {
        throw new QueryException(ex.getMessage());
    }
}
 
开发者ID:valdasraps,项目名称:resthub,代码行数:21,代码来源:UpdateSelectParser.java

示例3: visit

import net.sf.jsqlparser.schema.Table; //导入方法依赖的package包/类
@Override
public void visit(Table table) {
    String tableWholeName = table.getName();
    
    String tableOrginName = table.getName();
    String index = String.valueOf(MVEL.eval(this.expression, this.param));
    String suffix = StringUtils.leftPad(index, 4, "0");
    table.setName(tableOrginName + AbstractTableRouter.TABLE_NAME_SLIPTOR + suffix);
    
    tables.add(tableWholeName);
}
 
开发者ID:devpage,项目名称:sharding-quickstart,代码行数:12,代码来源:TablesNamesFinder.java

示例4: processConvert

import net.sf.jsqlparser.schema.Table; //导入方法依赖的package包/类
@Override
protected Statement processConvert(Statement statement,String tableName, Object param, String expression) {
    Update update = (Update) statement;
    
    Table table = update.getTables().get(0);
    
    String tableOrginName = table.getName();
    
    String index = calcFunctionExpressionResult(expression, param);
    
    String suffix = getSuffixedIndex(index);
    table.setName(super.concatTableName(tableOrginName, suffix));
    return update;
}
 
开发者ID:devpage,项目名称:sharding-quickstart,代码行数:15,代码来源:UpdateSingleTableRoute.java

示例5: visit

import net.sf.jsqlparser.schema.Table; //导入方法依赖的package包/类
@Override
public void visit(Table table) 
{
    String fullyQualifiedName = table.getFullyQualifiedName();
    if (!otherItemNames.contains(fullyQualifiedName.toLowerCase()))
    {
        String oldTableName=table.getName();
        String newTableName=this.tableRenamer.rename(oldTableName);
        table.setName(newTableName);
    }
}
 
开发者ID:sogou-biztech,项目名称:compass,代码行数:12,代码来源:TableRenameVisitor.java

示例6: visit

import net.sf.jsqlparser.schema.Table; //导入方法依赖的package包/类
@Override
public void visit(Table tableName) {
    String tableNameName = tableName.getName();

    if (includePattern.matcher(tableNameName).find()) {

        String newName = convertTableName(tableNameName, suffix);
        tableName.setName(newName);
    }
}
 
开发者ID:lysu,项目名称:mybatis-shard,代码行数:11,代码来源:SelectSqlConverter.java

示例7: addColumn

import net.sf.jsqlparser.schema.Table; //导入方法依赖的package包/类
public int addColumn(String tableName, NewColumnField columnField) throws Exception {
    String tmpTableName = "@[email protected]";
    dropTable(tmpTableName);

    try {
        _db.beginTransaction();

        List<String> list = getColumnFieldNameList(tableName);
        String oldColumns = "";
        for (String str : list) {
            if (TextUtils.isEmpty(oldColumns)) {
                oldColumns = "'" + str + "'";
            } else {
                oldColumns = oldColumns + "," + "'" + str + "'";
            }
        }

        //1:获取原始表的sql
        String sql = "SELECT sql FROM sqlite_master WHERE type='table' AND name='" + tableName + "'";

        Cursor cursor = _db.rawQuery(sql, null);
        if (cursor == null) return Constant.FAIL;

        if (!cursor.moveToFirst()) {
            cursor.close();
            return Constant.FAIL;
        }

        String sqlStr = cursor.getString(0);
        cursor.close();

        if (TextUtils.isEmpty(sqlStr)) return Constant.FAIL;

        CreateTable select = (CreateTable) CCJSqlParserUtil.parse(sqlStr);
        List<ColumnDefinition> columnsNames = select.getColumnDefinitions();

        ColumnDefinition newDefinition = new ColumnDefinition();
        newDefinition.setColumnName(columnField.getFieldName());
        newDefinition.setColumnSpecStrings(SQLTools.getConditionList(columnField));

        ColDataType type = new ColDataType();
        type.setDataType(columnField.getFieldType());
        newDefinition.setColDataType(type);
        columnsNames.add(newDefinition);

        Table table = select.getTable();
        table.setName("'" + tmpTableName + "'");
        select.setTable(table);
        Logger.d(select);

        sql = select.toString();
        _db.execSQL(sql);

        sql = "INSERT INTO '" + tmpTableName + "' (" + oldColumns + ") SELECT * FROM '" + tableName + "'";
        _db.execSQL(sql);

        sql = "DROP TABLE IF EXISTS '" + tableName + "'";
        _db.execSQL(sql);

        sql = "ALTER TABLE '" + tmpTableName + "' RENAME TO '" + tableName + "'";
        _db.execSQL(sql);

        _db.setTransactionSuccessful();

    } catch (Exception e) {
        e.printStackTrace();
        return Constant.FAIL;

    } finally {
        SQLManager.getSQLHelper()._db.endTransaction();
    }


    return Constant.SUCCESS;
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:76,代码来源:SQLHelper.java


注:本文中的net.sf.jsqlparser.schema.Table.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。