net.sf.jsqlparser.schema.Table.getName()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(210)

本文整理了Java中net.sf.jsqlparser.schema.Table.getName()方法的一些代码示例,展示了Table.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getName()方法的具体详情如下:
包路径:net.sf.jsqlparser.schema.Table
类名称:Table
方法名:getName

Table.getName介绍

暂无

代码示例

代码示例来源:origin: baomidou/mybatis-plus

  1. /**
  2. * 租户字段别名设置
  3. * <p>tableName.tenantId 或 tableAlias.tenantId</p>
  4. *
  5. * @param table 表对象
  6. * @return 字段
  7. */
  8. protected Column getAliasColumn(Table table) {
  9. StringBuilder column = new StringBuilder();
  10. if (null == table.getAlias()) {
  11. column.append(table.getName());
  12. } else {
  13. column.append(table.getAlias().getName());
  14. }
  15. column.append(StringPool.DOT);
  16. column.append(tenantHandler.getTenantIdColumn());
  17. return new Column(column.toString());
  18. }
  19. }

代码示例来源:origin: baomidou/mybatis-plus

  1. String tableInfo = table.getName();

代码示例来源:origin: baomidou/mybatis-plus

  1. /**
  2. * update 语句处理
  3. */
  4. @Override
  5. public void processUpdate(Update update) {
  6. List<Table> tableList = update.getTables();
  7. Assert.isTrue(null != tableList && tableList.size() < 2,
  8. "Failed to process multiple-table update, please exclude the statementId");
  9. Table table = tableList.get(0);
  10. if (tenantHandler.doTableFilter(table.getName())) {
  11. // 过滤退出执行
  12. return;
  13. }
  14. update.setWhere(this.andExpression(table, update.getWhere()));
  15. }

代码示例来源:origin: JSQLParser/JSqlParser

  1. @Override
  2. public void visit(Column tableColumn) {
  3. if (allowColumnProcessing && tableColumn.getTable() != null && tableColumn.getTable().getName() != null) {
  4. visit(tableColumn.getTable());
  5. }
  6. }

代码示例来源:origin: pagehelper/Mybatis-PageHelper

  1. allColumnsTables.add(((AllTableColumns) item).getTable().getName());
  2. String table = ((Column) expression).getTable().getName();
  3. if (table == null) { // 表名为空
  4. if (allColumns ||

代码示例来源:origin: baomidou/mybatis-plus

  1. /**
  2. * delete 语句处理
  3. */
  4. @Override
  5. public void processDelete(Delete delete) {
  6. if (tenantHandler.doTableFilter(delete.getTable().getName())) {
  7. // 过滤退出执行
  8. return;
  9. }
  10. delete.setWhere(this.andExpression(delete.getTable(), delete.getWhere()));
  11. }

代码示例来源:origin: baomidou/mybatis-plus

  1. /**
  2. * 处理联接语句
  3. */
  4. protected void processJoin(Join join) {
  5. if (join.getRightItem() instanceof Table) {
  6. Table fromTable = (Table) join.getRightItem();
  7. if (this.tenantHandler.doTableFilter(fromTable.getName())) {
  8. // 过滤退出执行
  9. return;
  10. }
  11. join.setOnExpression(builderExpression(join.getOnExpression(), fromTable));
  12. }
  13. }

代码示例来源:origin: codingapi/tx-lcn

  1. });
  2. for (Table table : update.getTables()) {
  3. tables.add(table.getName());
  4. TableStruct tableStruct = tableStructAnalyser.analyse(connection, table.getName());
  5. tableStruct.getPrimaryKeys().forEach(key -> primaryKeys.add(table.getName() + "." + key));

代码示例来源:origin: codingapi/tx-lcn

  1. Connection connection = (Connection) DTXLocal.cur().getResource();
  2. Insert insert = (Insert) statementInformation.getAttachment();
  3. TableStruct tableStruct = tableStructAnalyser.analyse(connection, insert.getTable().getName());

代码示例来源:origin: baomidou/mybatis-plus

  1. /**
  2. * insert 语句处理
  3. */
  4. @Override
  5. public void processInsert(Insert insert) {
  6. if (tenantHandler.doTableFilter(insert.getTable().getName())) {
  7. // 过滤退出执行
  8. return;
  9. }
  10. insert.getColumns().add(new Column(tenantHandler.getTenantIdColumn()));
  11. if (insert.getSelect() != null) {
  12. processPlainSelect((PlainSelect) insert.getSelect().getSelectBody(), true);
  13. } else if (insert.getItemsList() != null) {
  14. // fixed github pull/295
  15. ItemsList itemsList = insert.getItemsList();
  16. if (itemsList instanceof MultiExpressionList) {
  17. ((MultiExpressionList) itemsList).getExprList().forEach(el -> el.getExpressions().add(tenantHandler.getTenantId()));
  18. } else {
  19. ((ExpressionList) insert.getItemsList()).getExpressions().add(tenantHandler.getTenantId());
  20. }
  21. } else {
  22. throw ExceptionUtils.mpe("Failed to process multiple-table update, please exclude the tableName or statementId");
  23. }
  24. }

代码示例来源:origin: codingapi/tx-lcn

  1. TableStruct tableStruct = tableStructAnalyser.analyse(connection, table.getName());
  2. tableStruct.getColumns().forEach((k, v) -> {
  3. columns.add(tableStruct.getTableName() + SqlUtils.DOT + k);

代码示例来源:origin: baomidou/mybatis-plus

  1. /**
  2. * 处理 PlainSelect
  3. *
  4. * @param plainSelect ignore
  5. * @param addColumn 是否添加租户列,insert into select语句中需要
  6. */
  7. protected void processPlainSelect(PlainSelect plainSelect, boolean addColumn) {
  8. FromItem fromItem = plainSelect.getFromItem();
  9. if (fromItem instanceof Table) {
  10. Table fromTable = (Table) fromItem;
  11. if (tenantHandler.doTableFilter(fromTable.getName())) {
  12. // 过滤退出执行
  13. return;
  14. }
  15. plainSelect.setWhere(builderExpression(plainSelect.getWhere(), fromTable));
  16. if (addColumn) {
  17. plainSelect.getSelectItems().add(new SelectExpressionItem(new Column(tenantHandler.getTenantIdColumn())));
  18. }
  19. } else {
  20. processFromItem(fromItem);
  21. }
  22. List<Join> joins = plainSelect.getJoins();
  23. if (joins != null && joins.size() > 0) {
  24. joins.forEach(j -> {
  25. processJoin(j);
  26. processFromItem(j.getRightItem());
  27. });
  28. }
  29. }

代码示例来源:origin: codingapi/tx-lcn

  1. Connection connection = (Connection) DTXLocal.cur().getResource();
  2. TableStruct leftTableStruct = tableStructAnalyser.analyse(connection, leftTable.getName());
  3. leftTableStruct.getPrimaryKeys().forEach(primaryKey -> {
  4. Column column = new Column(leftTable, primaryKey);

代码示例来源:origin: baomidou/mybatis-plus

  1. Expression rightExpression = ((BinaryExpression) expression).getRightExpression();
  2. if (joinTable != null && rightExpression instanceof Column) {
  3. if (Objects.equals(((Column) rightExpression).getTable().getName(), table.getAlias().getName())) {
  4. validUseIndex(table, ((Column) rightExpression).getColumnName(), connection);
  5. validUseIndex(joinTable, ((Column) leftExpression).getColumnName(), connection);

代码示例来源:origin: geotools/geotools

  1. private static List getTableColumns(ISession session, Table table) throws IOException {
  2. List colNames = new ArrayList();
  3. String tableName = table.getSchemaName() + "." + table.getName();
  4. SeColumnDefinition[] cols = session.describe(tableName);
  5. for (int i = 0; i < cols.length; i++) {
  6. String colName = cols[i].getName();
  7. colName = tableName + "." + colName;
  8. colNames.add(colName);
  9. }
  10. return colNames;
  11. }
  12. }

代码示例来源:origin: geotools/geotools

  1. final String userName;
  2. qualifiedTable.setName(table.getName());
  3. qualifiedTable.setAlias(table.getAlias());

代码示例来源:origin: geotools/geotools

  1. Table unaliasedTable = (Table) tableAliases.get(qt.getName());
  2. String tableName = qt.getSchemaName() + "." + qt.getName();
  3. SeColumnDefinition[] cols;
  4. try {

代码示例来源:origin: geotools/geotools

  1. public static Column qualify(
  2. ISession session, Map<String, Object> tableAliases, Column column) {
  3. Table table = column.getTable();
  4. String columnName = column.getColumnName();
  5. Table unaliasedTable = (Table) tableAliases.get(table.getName());
  6. Table qualifiedTable;
  7. if (unaliasedTable == null) {
  8. // not an aliased table, qualify it
  9. qualifiedTable = TableQualifier.qualify(session, table);
  10. } else {
  11. // AllTableColumns is refering to an aliased table in the FROM
  12. // clause,
  13. // replace its table by the original one to get rid of the alias
  14. qualifiedTable = unaliasedTable;
  15. }
  16. Column qualifiedColumn = new Column();
  17. qualifiedColumn.setColumnName(columnName);
  18. qualifiedColumn.setTable(qualifiedTable);
  19. return qualifiedColumn;
  20. }
  21. }

代码示例来源:origin: com.manydesigns/portofino-database

  1. private static boolean hasEntityAlias(String entityName, FromItem fromItem) {
  2. return fromItem instanceof net.sf.jsqlparser.schema.Table &&
  3. ((net.sf.jsqlparser.schema.Table) fromItem).getName().equals(entityName) &&
  4. fromItem.getAlias() != null &&
  5. !StringUtils.isBlank(fromItem.getAlias().getName());
  6. }

代码示例来源:origin: io.konig/konig-schemagen

  1. private Shape createTableShape(CreateTable createTable, List<ColumnDefinition> columnList) {
  2. String tableName = createTable.getTable().getName();
  3. String shapeId = tableName.replaceAll(tableConfig.getTableIriTemplate().getIriPattern(), tableConfig.getTableIriTemplate().getIriReplacement());
  4. Shape shape = new Shape(new URIImpl(shapeId));
  5. addPropertyContraint(shape, columnList);
  6. return shape;
  7. }

相关文章