/** * INTERNAL: * Produce a DataReadQuery which updates(!) the sequence number in the db * and returns it. * @param qualifiedSeqName known by TimesTen to be a defined sequence */ @Override public ValueReadQuery buildSelectQueryForSequenceObject(String qualifiedSeqName, Integer size) { return new ValueReadQuery("SELECT " + qualifiedSeqName + ".NEXTVAL FROM DUAL"); }
/** * INTERNAL: DB2 added SEQUENCE support as of (I believe) v8. */ @Override public ValueReadQuery buildSelectQueryForSequenceObject(String qualifiedSeqName, Integer size) { return new ValueReadQuery("VALUES(NEXT VALUE FOR " + qualifiedSeqName + ")"); }
/** * INTERNAL: Produce a DataReadQuery which updates(!) the sequence number in * the database and returns it. * * @param qualifiedSeqName * a defined database sequence */ @Override public ValueReadQuery buildSelectQueryForSequenceObject(String qualifiedSeqName, Integer size) { return new ValueReadQuery("SELECT NEXT VALUE FOR " + qualifiedSeqName); }
/** * INTERNAL: * Produce a DataReadQuery which updates(!) the sequence number in the db * and returns it. Currently implemented on Oracle only. * @param qualifiedSeqName known by Oracle to be a defined sequence */ @Override public ValueReadQuery buildSelectQueryForSequenceObject(String qualifiedSeqName, Integer size) { return new ValueReadQuery("SELECT " + qualifiedSeqName + ".NEXTVAL FROM DUAL"); }
/** * INTERNAL: * Produce a DataReadQuery which updates(!) the sequence number in the db * and returns it. * @param qualifiedSeqName known by TimesTen to be a defined sequence */ @Override public ValueReadQuery buildSelectQueryForSequenceObject(String qualifiedSeqName, Integer size) { return new ValueReadQuery("SELECT " + qualifiedSeqName + ".NEXTVAL FROM DUAL"); }
/** * INTERNAL: * Though Oracle doesn't support identity it could be imitated, * see comment to setSupportsIdentity method. * @param qualifiedSeqName known by Oracle to be a defined sequence */ @Override public ValueReadQuery buildSelectQueryForIdentity(String qualifiedSeqName, Integer size) { return new ValueReadQuery("SELECT " + qualifiedSeqName + ".CURRVAL FROM DUAL"); }
/** * INTERNAL: Returns query used to read value generated by sequence object * (like Oracle sequence). This method is called when sequence object * NativeSequence is connected, the returned query used until the sequence * is disconnected. If the platform supportsSequenceObjects then (at least) * one of buildSelectQueryForSequenceObject methods should return non-null * query. */ @Override public ValueReadQuery buildSelectQueryForSequenceObject(String qualifiedSeqName, Integer size) { return new ValueReadQuery("select nextval(\'" + qualifiedSeqName + "\')"); }
/** * INTERNAL: * Returns query used to read value generated by sequence object (like Oracle sequence). * This method is called when sequence object NativeSequence is connected, * the returned query used until the sequence is disconnected. * If the platform supportsSequenceObjects then (at least) one of buildSelectQueryForSequenceObject * methods should return non-null query. */ public ValueReadQuery buildSelectQueryForSequenceObject(String qualifiedSeqName, Integer size) { return new ValueReadQuery("select " + qualifiedSeqName + ".nextval from systables where tabid = 1"); }
/** * INTERNAL: Returns query used to read value generated by sequence object * (like Oracle sequence). This method is called when sequence object * NativeSequence is connected, the returned query used until the sequence * is disconnected. If the platform supportsSequenceObjects then (at least) * one of buildSelectQueryForSequenceObject methods should return non-null * query. */ @Override public ValueReadQuery buildSelectQueryForSequenceObject(String qualifiedSeqName, Integer size) { return new ValueReadQuery("select nextval(\'" + qualifiedSeqName + "\')"); }
/** * INTERNAL: * Produce a DataReadQuery which updates(!) the sequence number in the db * and returns it. * @param qualifiedSeqName known by TimesTen to be a defined sequence */ @Override public ValueReadQuery buildSelectQueryForSequenceObject(String qualifiedSeqName, Integer size) { return new ValueReadQuery("SELECT " + qualifiedSeqName + ".NEXTVAL FROM DUAL"); }
@Override public ValueReadQuery buildSelectQueryForSequenceObject(String seqName, Integer size) { StringBuilder builder = new StringBuilder(26 + seqName.length()); builder.append("SELECT GEN_ID("); builder.append(seqName); builder.append(", "); builder.append(size); builder.append(") FROM RDB$DATABASE"); return new ValueReadQuery(builder.toString()); }
/** * INTERNAL: * Build the identity query for native sequencing. */ @Override public ValueReadQuery buildSelectQueryForIdentity() { ValueReadQuery selectQuery = new ValueReadQuery(); StringWriter writer = new StringWriter(); writer.write("SELECT @@IDENTITY"); selectQuery.setSQLString(writer.toString()); return selectQuery; }
/** * INTERNAL: Build the identity query for native sequencing. */ @Override public ValueReadQuery buildSelectQueryForIdentity() { ValueReadQuery selectQuery = new ValueReadQuery(); StringWriter writer = new StringWriter(); writer.write("SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1"); selectQuery.setSQLString(writer.toString()); return selectQuery; }
/** * INTERNAL: * Build the identity query for native sequencing. */ public ValueReadQuery buildSelectQueryForIdentity() { ValueReadQuery selectQuery = new ValueReadQuery(); StringWriter writer = new StringWriter(); writer.write("SELECT @@IDENTITY"); selectQuery.setSQLString(writer.toString()); return selectQuery; }
/** * PUBLIC: * TimesTen uses the Oracle syntax for getting the current timestamp. */ @Override public ValueReadQuery getTimestampQuery() { if (this.timestampQuery == null) { this.timestampQuery = new ValueReadQuery(); this.timestampQuery.setSQLString("SELECT SYSDATE FROM DUAL"); } return this.timestampQuery; }
protected ValueReadQuery buildSelectQuery(String seqName, Integer size) { ValueReadQuery selectQuery = new ValueReadQuery(); selectQuery.dontBindAllParameters(); StringWriter writer = new StringWriter(selectStringBufferSize + seqName.length()); writer.write(selectString1); writer.write(seqName); selectQuery.setSQLString(writer.toString()); return selectQuery; }
@Override public ValueReadQuery getTimestampQuery() { if (timestampQuery == null) { timestampQuery = new ValueReadQuery(); timestampQuery.setSQLString("SELECT CURRENT_TIMESTAMP()"); timestampQuery.setAllowNativeSQLQuery(true); } return timestampQuery; }
@Override public ValueReadQuery getTimestampQuery() { if (this.timestampQuery == null) { this.timestampQuery = new ValueReadQuery(); this.timestampQuery.setSQLString("CALL CURRENT_TIMESTAMP"); this.timestampQuery.setAllowNativeSQLQuery(true); } return this.timestampQuery; }
@Override public ValueReadQuery getTimestampQuery() { if (timestampQuery == null) { timestampQuery = new ValueReadQuery(); timestampQuery.setSQLString("SELECT CURRENT_TIMESTAMP()"); timestampQuery.setAllowNativeSQLQuery(true); } return timestampQuery; }
protected ValueReadQuery buildSelectQuery() { ValueReadQuery query = new ValueReadQuery(); query.addArgument(getNameFieldName()); StringWriter writer = new StringWriter(); writer.write("SELECT " + getCounterFieldName()); writer.write(" FROM " + getQualifiedTableName()); writer.write(" WHERE " + getNameFieldName()); writer.write(" = #" + getNameFieldName()); query.setSQLString(writer.toString()); return query; }