/** * INTERAL: * Execute the SQL required to insert the sequence row into the sequence table. * Assume that the sequence table exists. */ public boolean checkIfExist(AbstractSession session) throws DatabaseException { StringBuilder buffer = new StringBuilder(); buffer.append("SELECT * FROM "); buffer.append(getSequenceTableQualifiedName()); buffer.append(" WHERE "); buffer.append(getSequenceNameFieldName()); buffer.append(" = '"); buffer.append(getName()); buffer.append("'"); Vector results = session.priviledgedExecuteSelectingCall(new org.eclipse.persistence.queries.SQLCall(buffer.toString())); return !results.isEmpty(); }
/** * INTERAL: * Execute the SQL required to insert the sequence row into the sequence table. * Assume that the sequence table exists. */ public boolean checkIfExist(AbstractSession session) throws DatabaseException { StringBuilder buffer = new StringBuilder(); buffer.append("SELECT * FROM "); buffer.append(getSequenceTableQualifiedName()); buffer.append(" WHERE "); buffer.append(getSequenceNameFieldName()); buffer.append(" = '"); buffer.append(getName()); buffer.append("'"); Vector results = session.priviledgedExecuteSelectingCall(new org.eclipse.persistence.queries.SQLCall(buffer.toString())); return !results.isEmpty(); }
/** * INTERNAL: * Return the SQL to delete the row from the sequence table. */ public Writer buildDeletionWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("DELETE FROM "); writer.write(getSequenceTableName()); writer.write(" WHERE " + getSequenceNameFieldName()); writer.write(" = '" + getName() + "'"); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * INTERNAL: * Return the SQL required to insert the sequence row into the sequence table. * Assume that the sequence table exists. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("INSERT INTO "); writer.write(getSequenceTableQualifiedName()); writer.write("(" + getSequenceNameFieldName()); writer.write(", " + getSequenceCounterFieldName()); writer.write(") values ("); writer.write("'" + getName() + "', " + Integer.toString(sequence.getInitialValue() - 1) + ")"); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * INTERNAL: * Return the SQL required to insert the sequence row into the sequence table. * Assume that the sequence table exists. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("INSERT INTO "); writer.write(getSequenceTableQualifiedName()); writer.write("(" + getSequenceNameFieldName()); writer.write(", " + getSequenceCounterFieldName()); writer.write(") values ("); writer.write("'" + getName() + "', " + Integer.toString(sequence.getInitialValue() - 1) + ")"); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * INTERNAL: * Return the SQL required to insert the sequence row into the sequence table. * Assume that the sequence table exists. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("INSERT INTO "); writer.write(getSequenceTableName()); writer.write("(" + getSequenceNameFieldName()); writer.write(", " + getSequenceCounterFieldName()); writer.write(") values ("); writer.write("'" + getName() + "', " + Integer.toString(sequence.getInitialValue() - 1) + ")"); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * INTERAL: * Execute the SQL required to insert the sequence row into the sequence table. * Assume that the sequence table exists. */ public boolean checkIfExist(AbstractSession session) throws DatabaseException { Vector results = session.executeSelectingCall(new org.eclipse.persistence.queries.SQLCall("SELECT * FROM " + getSequenceTableName() + " WHERE " + getSequenceNameFieldName() + " = '" + getName() + "'")); return !results.isEmpty(); }
/** * INTERNAL: * Return the SQL to delete the row from the sequence table. If we're * dealing with create creation, then delegate to the table so that is * dropped outright since we will delete the schema. */ public Writer buildDeletionWriter(AbstractSession session, Writer writer) throws ValidationException { if (shouldDropTableDefinition()) { return tableDefinition.buildDeletionWriter(session, writer); } else { try { writer.write("DELETE FROM "); writer.write(getSequenceTableQualifiedName()); writer.write(" WHERE " + getSequenceNameFieldName()); writer.write(" = '" + getName() + "'"); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; } }
/** * INTERNAL: * Return the SQL to delete the row from the sequence table. If we're * dealing with create creation, then delegate to the table so that is * dropped outright since we will delete the schema. */ public Writer buildDeletionWriter(AbstractSession session, Writer writer) throws ValidationException { if (shouldDropTableDefinition()) { return tableDefinition.buildDeletionWriter(session, writer); } else { try { writer.write("DELETE FROM "); writer.write(getSequenceTableQualifiedName()); writer.write(" WHERE " + getSequenceNameFieldName()); writer.write(" = '" + getName() + "'"); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; } }