Exemplo n.º 1
0
  /** Creates a new platform instance. */
  public InterbasePlatform() {
    PlatformInfo info = getPlatformInfo();

    info.setMaxIdentifierLength(31);
    info.setCommentPrefix("/*");
    info.setCommentSuffix("*/");
    info.setSystemForeignKeyIndicesAlwaysNonUnique(true);
    info.setPrimaryKeyColumnsHaveToBeRequired(true);

    // BINARY and VARBINARY are also handled by the InterbaseBuilder.getSqlType method
    info.addNativeTypeMapping(Types.ARRAY, "BLOB", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.BIGINT, "NUMERIC(18,0)");
    // Theoretically we could use (VAR)CHAR CHARACTER SET OCTETS but the JDBC driver is not
    // able to handle that properly (the byte[]/BinaryStream accessors do not work)
    info.addNativeTypeMapping(Types.BINARY, "BLOB", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.BIT, "SMALLINT", Types.SMALLINT);
    info.addNativeTypeMapping(Types.BLOB, "BLOB", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.BOOLEAN, "SMALLINT", Types.SMALLINT);
    info.addNativeTypeMapping(Types.CLOB, "BLOB SUB_TYPE TEXT");
    info.addNativeTypeMapping(Types.DATALINK, "BLOB", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.DISTINCT, "BLOB", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.DOUBLE, "DOUBLE PRECISION");
    info.addNativeTypeMapping(Types.FLOAT, "DOUBLE PRECISION", Types.DOUBLE);
    info.addNativeTypeMapping(Types.JAVA_OBJECT, "BLOB", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.LONGVARBINARY, "BLOB", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.LONGVARCHAR, "BLOB SUB_TYPE TEXT", Types.CLOB);
    info.addNativeTypeMapping(Types.NULL, "BLOB", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.OTHER, "BLOB", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.REAL, "FLOAT");
    info.addNativeTypeMapping(Types.REF, "BLOB", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.STRUCT, "BLOB", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.TINYINT, "SMALLINT", Types.SMALLINT);
    info.addNativeTypeMapping(Types.VARBINARY, "BLOB", Types.LONGVARBINARY);

    info.setDefaultSize(Types.CHAR, 254);
    info.setDefaultSize(Types.VARCHAR, 254);
    info.setHasSize(Types.BINARY, false);
    info.setHasSize(Types.VARBINARY, false);

    setSqlBuilder(new InterbaseBuilder(this));
    setModelReader(new InterbaseModelReader(this));
  }
Exemplo n.º 2
0
  /** Creates a new platform instance. */
  public PostgreSqlPlatform() {
    PlatformInfo info = getPlatformInfo();

    info.setPrimaryKeyColumnAutomaticallyRequired(true);
    // this is the default length though it might be changed when building PostgreSQL
    // in file src/include/postgres_ext.h
    info.setMaxIdentifierLength(31);

    info.addNativeTypeMapping(Types.ARRAY, "BYTEA", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.BINARY, "BYTEA", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.BIT, "BOOLEAN");
    info.addNativeTypeMapping(Types.BLOB, "BYTEA", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.BOOLEAN, "BOOLEAN", Types.BIT);
    info.addNativeTypeMapping(Types.CLOB, "TEXT", Types.LONGVARCHAR);
    info.addNativeTypeMapping(Types.DATALINK, "BYTEA", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.DECIMAL, "NUMERIC", Types.NUMERIC);
    info.addNativeTypeMapping(Types.DISTINCT, "BYTEA", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.DOUBLE, "DOUBLE PRECISION");
    info.addNativeTypeMapping(Types.FLOAT, "DOUBLE PRECISION", Types.DOUBLE);
    info.addNativeTypeMapping(Types.JAVA_OBJECT, "BYTEA", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.LONGVARBINARY, "BYTEA");
    info.addNativeTypeMapping(Types.LONGVARCHAR, "TEXT", Types.LONGVARCHAR);
    info.addNativeTypeMapping(Types.NULL, "BYTEA", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.OTHER, "BYTEA", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.REF, "BYTEA", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.STRUCT, "BYTEA", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.TINYINT, "SMALLINT", Types.SMALLINT);
    info.addNativeTypeMapping(Types.VARBINARY, "BYTEA", Types.LONGVARBINARY);

    info.setDefaultSize(Types.CHAR, 254);
    info.setDefaultSize(Types.VARCHAR, 254);

    // no support for specifying the size for these types (because they are mapped
    // to BYTEA which back-maps to BLOB)
    info.setHasSize(Types.BINARY, false);
    info.setHasSize(Types.VARBINARY, false);

    setSqlBuilder(new PostgreSqlBuilder(this));
    setModelReader(new PostgreSqlModelReader(this));
  }