本文整理汇总了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()));
}
}
}
示例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());
}
}
示例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);
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}