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

    info.setMaxIdentifierLength(128);
    info.setSystemForeignKeyIndicesAlwaysNonUnique(true);
    // BINARY and VARBINARY will also be handled by CloudscapeBuilder.getSqlType
    info.addNativeTypeMapping(Types.ARRAY, "BLOB", Types.BLOB);
    info.addNativeTypeMapping(Types.BINARY, "CHAR {0} FOR BIT DATA");
    info.addNativeTypeMapping(Types.BIT, "SMALLINT", Types.SMALLINT);
    info.addNativeTypeMapping(Types.DISTINCT, "BLOB", Types.BLOB);
    info.addNativeTypeMapping(Types.DOUBLE, "DOUBLE PRECISION");
    info.addNativeTypeMapping(Types.FLOAT, "DOUBLE PRECISION", Types.DOUBLE);
    info.addNativeTypeMapping(Types.JAVA_OBJECT, "BLOB", Types.BLOB);
    info.addNativeTypeMapping(Types.LONGVARBINARY, "LONG VARCHAR FOR BIT DATA");
    info.addNativeTypeMapping(Types.LONGVARCHAR, "LONG VARCHAR");
    info.addNativeTypeMapping(Types.NULL, "LONG VARCHAR FOR BIT DATA", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.OTHER, "BLOB", Types.BLOB);
    info.addNativeTypeMapping(Types.REF, "LONG VARCHAR FOR BIT DATA", Types.LONGVARBINARY);
    info.addNativeTypeMapping(Types.STRUCT, "BLOB", Types.BLOB);
    info.addNativeTypeMapping(Types.TINYINT, "SMALLINT", Types.SMALLINT);
    info.addNativeTypeMapping(Types.VARBINARY, "VARCHAR {0} FOR BIT DATA");
    info.addNativeTypeMapping("BOOLEAN", "SMALLINT", "SMALLINT");
    info.addNativeTypeMapping("DATALINK", "LONG VARCHAR FOR BIT DATA", "LONGVARBINARY");

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

    setSqlBuilder(new CloudscapeBuilder(this));
  }
Ejemplo n.º 2
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));
  }