/** * INTERNAL: * Return the DDL to create the varray. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("CREATE TYPE "); writer.write(getFullName()); writer.write(" AS TABLE OF "); appendTypeString(writer, session); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * INTERNAL: * Return the DDL to drop the varray. */ public Writer buildDeletionWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("DROP TYPE " + getFullName()); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * INTERNAL: * Append the type to the statement */ public void appendTypeString(Writer writer, AbstractSession session) throws ValidationException { FieldTypeDefinition fieldType; if (getType() != null) { fieldType = session.getPlatform().getFieldTypeDefinition(getType()); if (fieldType == null) { throw ValidationException.javaTypeIsNotAValidDatabaseType(getType()); } } else { fieldType = new FieldTypeDefinition(getTypeName()); } try { writer.write(fieldType.getName()); if ((fieldType.isSizeAllowed()) && ((getTypeSize() != 0) || (fieldType.isSizeRequired()))) { writer.write("("); if (getTypeSize() == 0) { writer.write(new Integer(fieldType.getDefaultSize()).toString()); } else { writer.write(new Integer(getTypeSize()).toString()); } writer.write(")"); } } catch (IOException ioException) { throw ValidationException.fileError(ioException); } }
/** * INTERNAL: * Append the type to the statement * @param writer Target writer where to write type string. * @param session Current session context. * @throws ValidationException When invalid or inconsistent data were found. */ public void appendTypeString(final Writer writer, final AbstractSession session) throws ValidationException { final FieldTypeDefinition fieldType = getFieldTypeDefinition(session, type, typeName); try { writer.write(fieldType.getName()); if ((fieldType.isSizeAllowed()) && ((typeSize != 0) || (fieldType.isSizeRequired()))) { writer.write("("); if (typeSize == 0) { writer.write(Integer.toString(fieldType.getDefaultSize() )); } else { writer.write(Integer.toString(typeSize)); } writer.write(")"); } } catch (IOException ioException) { throw ValidationException.fileError(ioException); } }
/** * INTERNAL: * Return the DDL to drop the varray. */ public Writer buildDeletionWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("DROP TYPE " + getFullName()); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * INTERNAL: * Append the type to the statement * @param writer Target writer where to write type string. * @param session Current session context. * @throws ValidationException When invalid or inconsistent data were found. */ public void appendTypeString(final Writer writer, final AbstractSession session) throws ValidationException { final FieldTypeDefinition fieldType = getFieldTypeDefinition(session, type, typeName); try { writer.write(fieldType.getName()); if ((fieldType.isSizeAllowed()) && ((typeSize != 0) || (fieldType.isSizeRequired()))) { writer.write("("); if (typeSize == 0) { writer.write(Integer.toString(fieldType.getDefaultSize() )); } else { writer.write(Integer.toString(typeSize)); } writer.write(")"); } } catch (IOException ioException) { throw ValidationException.fileError(ioException); } }
/** * INTERNAL: * Return the DDL to create the varray. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("CREATE TYPE "); writer.write(getFullName()); writer.write(" AS TABLE OF "); appendTypeString(writer, session); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * INTERNAL: * Return the DDL to drop the varray. */ public Writer buildDeletionWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("DROP TYPE " + getFullName()); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * INTERNAL: * Return the DDL to create the varray. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("CREATE TYPE "); writer.write(getFullName()); writer.write(" AS TABLE OF "); appendTypeString(writer, session); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }