[#1887] Remove all deprecated code

This commit is contained in:
Lukas Eder 2013-01-04 14:44:26 +01:00
parent cafadd5b0f
commit 5c97482f4c
3 changed files with 13 additions and 61 deletions

View File

@ -376,6 +376,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, I, IPK, T725,
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testARRAYType() throws Exception {
if (TArrays() == null) {
@ -414,9 +415,12 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, I, IPK, T725,
InsertQuery<?> insert = create().insertQuery(TArrays());
insert.addValue(TArrays_ID(), 5);
insert.addValueAsArray(TArrays_NUMBER_R(), 1, 2, 3);
insert.addValueAsArray(TArrays_STRING_R(), "a", "b", "c", "d\"\\d");
insert.addValueAsArray(TArrays_DATE_R(), new Date(0), new Date(84600 * 1000), new Date(84600 * 2000));
insert.addValue((Field) TArrays_NUMBER_R(),
on(TArrays_NUMBER_R().getType()).create(create(), new Integer[] { 1, 2, 3 }).get());
insert.addValue((Field) TArrays_STRING_R(),
on(TArrays_STRING_R().getType()).create(create(), new String[] { "a", "b", "c", "d\"\\d" }).get());
insert.addValue((Field) TArrays_DATE_R(),
on(TArrays_DATE_R().getType()).create(create(), new Date[] { new Date(0), new Date(84600 * 1000), new Date(84600 * 2000) }).get());
insert.execute();
Record array = create().select(
@ -434,9 +438,12 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, I, IPK, T725,
UpdateQuery<X> update = create().updateQuery(TArrays());
update.addValueAsArray(TArrays_NUMBER_R(), 3, 2, 1);
update.addValueAsArray(TArrays_STRING_R(), "d\"\\d", "c", "b", "a");
update.addValueAsArray(TArrays_DATE_R(), new Date(84600 * 2000), new Date(84600 * 1000), new Date(0));
update.addValue((Field) TArrays_NUMBER_R(),
on(TArrays_NUMBER_R().getType()).create(create(), new Integer[] { 3, 2, 1 }).get());
update.addValue((Field) TArrays_STRING_R(),
on(TArrays_STRING_R().getType()).create(create(), new String[] { "d\"\\d", "c", "b", "a" }).get());
update.addValue((Field) TArrays_DATE_R(),
on(TArrays_DATE_R().getType()).create(create(), new Date[] { new Date(84600 * 2000), new Date(84600 * 1000), new Date(0) }).get());
update.addConditions(TArrays_ID().equal(5));
update.execute();

View File

@ -35,9 +35,6 @@
*/
package org.jooq;
import static org.jooq.SQLDialect.ORACLE;
import java.util.List;
import java.util.Map;
/**
@ -86,26 +83,4 @@ public interface StoreQuery<R extends Record> extends Query {
@Support
void addValues(Map<? extends Field<?>, ?> map);
/**
* Add a value to the store statement
*
* @param <A> The field type
* @param <T> The array type
* @param field The field
* @param value The value
*/
@Support(ORACLE)
<A extends ArrayRecord<T>, T> void addValueAsArray(Field<A> field, T... value);
/**
* Add a value to the store statement
*
* @param <A> The field type
* @param <T> The array type
* @param field The field
* @param value The value
*/
@Support(ORACLE)
<A extends ArrayRecord<T>, T> void addValueAsArray(Field<A> field, List<T> value);
}

View File

@ -37,11 +37,8 @@ package org.jooq.impl;
import static org.jooq.impl.Factory.val;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.jooq.ArrayRecord;
import org.jooq.Configuration;
import org.jooq.Field;
import org.jooq.Record;
@ -92,31 +89,4 @@ abstract class AbstractStoreQuery<R extends Record> extends AbstractQuery implem
getValues().put(field, value);
}
}
@Override
public final <A extends ArrayRecord<T>, T> void addValueAsArray(Field<A> field, T... value) {
if (value == null) {
getValues().put(field, val(null, field));
}
else {
addValueAsArray(field, Arrays.asList(value));
}
}
@Override
public final <A extends ArrayRecord<T>, T> void addValueAsArray(Field<A> field, List<T> value) {
if (value == null) {
getValues().put(field, val(null, field));
}
else {
try {
A record = Utils.newArrayRecord(field.getType(), getConfiguration());
record.setList(value);
addValue(field, record);
}
catch (Exception e) {
throw new IllegalArgumentException("Field is not a valid ArrayRecord field: " + field);
}
}
}
}