Beispiel #1
0
    @Override
    public final String getSchemaName(int column) throws SQLException {
      checkNotClosed();

      Field<?> field = result.getField(column - 1);
      if (field instanceof TableField) {
        Table<?> table = ((TableField<?, ?>) field).getTable();

        if (table != null) {
          Schema schema = table.getSchema();

          if (schema != null) {
            Configuration configuration = ((AttachableInternal) result).getConfiguration();
            Schema mapped = null;

            if (configuration != null) {
              mapped = Utils.getMappedSchema(configuration, schema);
            }

            if (mapped != null) {
              return mapped.getName();
            } else {
              return schema.getName();
            }
          }
        }
      }

      // By default, no schema is available
      return "";
    }
Beispiel #2
0
  private final void accept0(Context<?> ctx, boolean asStringLiterals) {
    Schema mappedSchema = Utils.getMappedSchema(ctx.configuration(), schema);

    if (mappedSchema != null && ctx.family() != CUBRID) {
      if (asStringLiterals) {
        ctx.visit(inline(mappedSchema.getName())).sql(", ");
      } else {
        ctx.visit(mappedSchema).sql('.');
      }
    }

    if (asStringLiterals) ctx.visit(inline(name));
    else if (nameIsPlainSQL) ctx.sql(name);
    else ctx.literal(name);
  }
Beispiel #3
0
    protected final Table<?> getTable(String name) throws Exception {
        Schema schema = TAuthor().getSchema();

        if (schema == null) {
            Class<?> tables = Class.forName("org.jooq.test." + dialect().getName().toLowerCase() + ".generatedclasses.Tables");
            return (Table<?>) tables.getField(name).get(tables);
        }
        else {
            Table<?> result = schema.getTable(name);

            if (result == null) {
                result = schema.getTable(name.toUpperCase());
            }

            if (result == null) {
                result = schema.getTable(name.toLowerCase());
            }

            return result;
        }
    }