mirror of
https://github.com/moparisthebest/JdbcMapper
synced 2024-11-28 03:42:23 -05:00
Remove Blob and Clob annotations in favor of SQL bind syntax
This commit is contained in:
parent
ba7fb733b2
commit
edd6fc6e65
@ -103,35 +103,6 @@ public interface JdbcMapper extends Closeable {
|
|||||||
long maxRows() default -1;
|
long maxRows() default -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// these are to annotate parameters for special bind to PreparedStatement behavior
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use PreparedStatement.setBlob
|
|
||||||
*
|
|
||||||
* Only required for String
|
|
||||||
*
|
|
||||||
* Also valid for byte[], InputStream, Blob, File. But for those .setBlob is called even without this annotation
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
|
||||||
@Target({ElementType.PARAMETER})
|
|
||||||
public @interface Blob {
|
|
||||||
/**
|
|
||||||
* The charsetName sent into String.getBytes()
|
|
||||||
*/
|
|
||||||
String charsetName() default "UTF-8";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use PreparedStatement.setClob
|
|
||||||
*
|
|
||||||
* Only valid for String
|
|
||||||
*
|
|
||||||
* Also valid for Clob, Reader. But for those .setClob is called even without this annotation
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
|
||||||
@Target({ElementType.PARAMETER})
|
|
||||||
public @interface Clob {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equivalent to QueryMapper.toObject for arrays, and .toSingleMap for maps
|
* Equivalent to QueryMapper.toObject for arrays, and .toSingleMap for maps
|
||||||
*/
|
*/
|
||||||
|
@ -34,7 +34,7 @@ import static com.moparisthebest.jdbc.codegen.JdbcMapperFactory.SUFFIX;
|
|||||||
@SupportedSourceVersion(SourceVersion.RELEASE_5)
|
@SupportedSourceVersion(SourceVersion.RELEASE_5)
|
||||||
public class JdbcMapperProcessor extends AbstractProcessor {
|
public class JdbcMapperProcessor extends AbstractProcessor {
|
||||||
|
|
||||||
private static final Pattern paramPattern = Pattern.compile("\\{(([^\\s]+)\\s+(([Nn][Oo][Tt]\\s+)?[Ii][Nn]\\s+))?([^}]+)\\}");
|
public static final Pattern paramPattern = Pattern.compile("\\{(([^\\s]+)\\s+(([Nn][Oo][Tt]\\s+)?[Ii][Nn]\\s+))?([BbCc][Ll][Oo][Bb]\\s*:\\s*([^:]+\\s*:\\s*)?)?([^}]+)\\}");
|
||||||
|
|
||||||
public static final SourceVersion RELEASE_8;
|
public static final SourceVersion RELEASE_8;
|
||||||
public static boolean java8;
|
public static boolean java8;
|
||||||
@ -334,19 +334,37 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
|||||||
final Matcher bindParamMatcher = paramPattern.matcher(sql.value());
|
final Matcher bindParamMatcher = paramPattern.matcher(sql.value());
|
||||||
final StringBuffer sb = new StringBuffer();
|
final StringBuffer sb = new StringBuffer();
|
||||||
while (bindParamMatcher.find()) {
|
while (bindParamMatcher.find()) {
|
||||||
final String paramName = bindParamMatcher.group(5);
|
final String paramName = bindParamMatcher.group(7);
|
||||||
final VariableElement bindParam = paramMap.get(paramName);
|
final VariableElement bindParam = paramMap.get(paramName);
|
||||||
if (bindParam == null) {
|
if (bindParam == null) {
|
||||||
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, String.format("@JdbcMapper.SQL sql has bind param '%s' not in method parameter list", paramName), methodElement);
|
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, String.format("@JdbcMapper.SQL sql has bind param '%s' not in method parameter list", paramName), methodElement);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
unusedParams.remove(paramName);
|
unusedParams.remove(paramName);
|
||||||
|
final String clobBlob = bindParamMatcher.group(5);
|
||||||
final String inColumnName = bindParamMatcher.group(2);
|
final String inColumnName = bindParamMatcher.group(2);
|
||||||
if (inColumnName == null) {
|
if (inColumnName == null) {
|
||||||
bindParams.add(bindParam);
|
|
||||||
bindParamMatcher.appendReplacement(sb, "?");
|
bindParamMatcher.appendReplacement(sb, "?");
|
||||||
|
if(clobBlob == null){
|
||||||
|
bindParams.add(bindParam);
|
||||||
|
} else {
|
||||||
|
// regex ensures this can only be C for clob or B for blob
|
||||||
|
final boolean clobNotBlob = 'C' == Character.toUpperCase(clobBlob.charAt(0));
|
||||||
|
final String blobCharset = bindParamMatcher.group(6);
|
||||||
|
if(clobNotBlob) {
|
||||||
|
if(blobCharset != null)
|
||||||
|
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "blob character set not valid with clob", bindParam);
|
||||||
|
bindParams.add(new SpecialVariableElement(bindParam, SpecialVariableElement.SpecialType.CLOB));
|
||||||
|
} else {
|
||||||
|
bindParams.add(new SpecialVariableElement(bindParam, SpecialVariableElement.SpecialType.BLOB, blobCharset == null ? null :
|
||||||
|
blobCharset.substring(0, blobCharset.indexOf(':')).trim()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
bindParams.add(new InListVariableElement(bindParam));
|
if(clobBlob != null)
|
||||||
|
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "cannot combine in/not in and clob/blob", bindParam);
|
||||||
|
bindParams.add(new SpecialVariableElement(bindParam, SpecialVariableElement.SpecialType.IN_LIST));
|
||||||
final boolean not = bindParamMatcher.group(4) != null;
|
final boolean not = bindParamMatcher.group(4) != null;
|
||||||
final String replacement;
|
final String replacement;
|
||||||
switch (databaseType) {
|
switch (databaseType) {
|
||||||
@ -632,34 +650,37 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
|||||||
String method = null;
|
String method = null;
|
||||||
|
|
||||||
// special behavior
|
// special behavior
|
||||||
if (param instanceof InListVariableElement) {
|
if (param instanceof SpecialVariableElement) {
|
||||||
final boolean collection;
|
final SpecialVariableElement specialParam = (SpecialVariableElement) param;
|
||||||
final TypeMirror componentType;
|
switch (specialParam.specialType) {
|
||||||
if (o.getKind() == TypeKind.ARRAY) {
|
case IN_LIST: {
|
||||||
collection = false;
|
final boolean collection;
|
||||||
componentType = ((ArrayType) o).getComponentType();
|
final TypeMirror componentType;
|
||||||
} else if (o.getKind() == TypeKind.DECLARED && types.isAssignable(o, collectionType)) {
|
if (o.getKind() == TypeKind.ARRAY) {
|
||||||
collection = true;
|
collection = false;
|
||||||
final DeclaredType dt = (DeclaredType) o;
|
componentType = ((ArrayType) o).getComponentType();
|
||||||
if (dt.getTypeArguments().isEmpty()) {
|
} else if (o.getKind() == TypeKind.DECLARED && types.isAssignable(o, collectionType)) {
|
||||||
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "@JdbcMapper.SQL in list syntax requires a Collection with a generic type parameter" + o.toString(), ((InListVariableElement) param).delegate);
|
collection = true;
|
||||||
return;
|
final DeclaredType dt = (DeclaredType) o;
|
||||||
}
|
if (dt.getTypeArguments().isEmpty()) {
|
||||||
componentType = dt.getTypeArguments().get(0);
|
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "@JdbcMapper.SQL in list syntax requires a Collection with a generic type parameter" + o.toString(), specialParam.delegate);
|
||||||
} else {
|
return;
|
||||||
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "@JdbcMapper.SQL in list syntax only valid on Collections or arrays" + o.toString(), ((InListVariableElement) param).delegate);
|
}
|
||||||
return;
|
componentType = dt.getTypeArguments().get(0);
|
||||||
}
|
} else {
|
||||||
w.write("ps.setArray(");
|
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "@JdbcMapper.SQL in list syntax only valid on Collections or arrays" + o.toString(), specialParam.delegate);
|
||||||
w.write(Integer.toString(index));
|
return;
|
||||||
w.write(", ");
|
}
|
||||||
final String type = types.isAssignable(componentType, numberType) ? arrayNumberTypeName : arrayStringTypeName;
|
w.write("ps.setArray(");
|
||||||
switch (databaseType) {
|
w.write(Integer.toString(index));
|
||||||
case ORACLE:
|
w.write(", ");
|
||||||
w.write("conn.unwrap(oracle.jdbc.OracleConnection.class).createOracleArray(\"");
|
final String type = types.isAssignable(componentType, numberType) ? arrayNumberTypeName : arrayStringTypeName;
|
||||||
|
switch (databaseType) {
|
||||||
|
case ORACLE:
|
||||||
|
w.write("conn.unwrap(oracle.jdbc.OracleConnection.class).createOracleArray(\"");
|
||||||
|
|
||||||
// todo: if oracle driver is not on compile-time classpath, would need to do:
|
// todo: if oracle driver is not on compile-time classpath, would need to do:
|
||||||
// we could also create a fake-oracle module that just had a oracle.jdbc.OracleConnection class implementing createOracleArray()...
|
// we could also create a fake-oracle module that just had a oracle.jdbc.OracleConnection class implementing createOracleArray()...
|
||||||
/*
|
/*
|
||||||
private static final Class<?> oracleConnection;
|
private static final Class<?> oracleConnection;
|
||||||
private static final Method createArray;
|
private static final Method createArray;
|
||||||
@ -677,51 +698,50 @@ public class JdbcMapperProcessor extends AbstractProcessor {
|
|||||||
createArray = ca;
|
createArray = ca;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
//w.write("(Array) createArray.invoke(conn.unwrap(oracleConnection), \"");
|
//w.write("(Array) createArray.invoke(conn.unwrap(oracleConnection), \"");
|
||||||
break;
|
break;
|
||||||
case STANDARD:
|
case STANDARD:
|
||||||
w.write("conn.createArrayOf(\"");
|
w.write("conn.createArrayOf(\"");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "default DatabaseType? should never happen!!", ((InListVariableElement) param).delegate);
|
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "default DatabaseType? should never happen!!", specialParam.delegate);
|
||||||
}
|
}
|
||||||
w.write(type);
|
w.write(type);
|
||||||
w.write("\", ");
|
w.write("\", ");
|
||||||
w.write(variableName);
|
w.write(variableName);
|
||||||
if (collection)
|
if (collection)
|
||||||
w.write(".toArray()");
|
w.write(".toArray()");
|
||||||
w.write("));\n");
|
w.write("));\n");
|
||||||
return;
|
|
||||||
}
|
|
||||||
final JdbcMapper.Blob blob = param.getAnnotation(JdbcMapper.Blob.class);
|
|
||||||
if (blob != null) {
|
|
||||||
if (types.isAssignable(o, stringType)) {
|
|
||||||
w.write("try {\n\t\t\t\tps.setBlob(");
|
|
||||||
w.write(Integer.toString(index));
|
|
||||||
w.write(", ");
|
|
||||||
w.write(variableName);
|
|
||||||
w.write(" == null ? null : new java.io.ByteArrayInputStream(");
|
|
||||||
w.write(variableName);
|
|
||||||
w.write(".getBytes(\"");
|
|
||||||
w.write(blob.charsetName());
|
|
||||||
w.write("\")));\n\t\t\t} catch (java.io.UnsupportedEncodingException e) {\n" +
|
|
||||||
"\t\t\t\tthrow new SQLException(\"String to Blob UnsupportedEncodingException\", e);\n" +
|
|
||||||
"\t\t\t}\n");
|
|
||||||
return;
|
|
||||||
} else if (!(types.isAssignable(o, inputStreamType) || types.isAssignable(o, blobType) || types.isAssignable(o, fileType) || types.isAssignable(o, byteArrayType))) {
|
|
||||||
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "@JdbcMapper.Blob only valid for String, byte[], Blob, InputStream, and File", param);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
final JdbcMapper.Clob clob = param.getAnnotation(JdbcMapper.Clob.class);
|
|
||||||
if (clob != null) {
|
|
||||||
if (types.isAssignable(o, stringType)) {
|
|
||||||
method = "Clob";
|
|
||||||
variableName = variableName + " == null ? null : new java.io.StringReader(" + variableName + ")";
|
|
||||||
} else if (!(types.isAssignable(o, readerType) || types.isAssignable(o, clobType))) {
|
|
||||||
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "@JdbcMapper.Clob only valid for String, Clob, Reader", param);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
case BLOB: {
|
||||||
|
if (types.isAssignable(o, stringType)) {
|
||||||
|
w.write("try {\n\t\t\t\tps.setBlob(");
|
||||||
|
w.write(Integer.toString(index));
|
||||||
|
w.write(", ");
|
||||||
|
w.write(variableName);
|
||||||
|
w.write(" == null ? null : new java.io.ByteArrayInputStream(");
|
||||||
|
w.write(variableName);
|
||||||
|
w.write(".getBytes(\"");
|
||||||
|
w.write(specialParam.blobStringCharset == null ? "UTF-8" : specialParam.blobStringCharset);
|
||||||
|
w.write("\")));\n\t\t\t} catch (java.io.UnsupportedEncodingException e) {\n" +
|
||||||
|
"\t\t\t\tthrow new SQLException(\"String to Blob UnsupportedEncodingException\", e);\n" +
|
||||||
|
"\t\t\t}\n");
|
||||||
|
return;
|
||||||
|
} else if (!(types.isAssignable(o, inputStreamType) || types.isAssignable(o, blobType) || types.isAssignable(o, fileType) || types.isAssignable(o, byteArrayType))) {
|
||||||
|
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "@JdbcMapper.Blob only valid for String, byte[], Blob, InputStream, and File", specialParam.delegate);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case CLOB: {
|
||||||
|
if (types.isAssignable(o, stringType)) {
|
||||||
|
method = "Clob";
|
||||||
|
variableName = variableName + " == null ? null : new java.io.StringReader(" + variableName + ")";
|
||||||
|
} else if (!(types.isAssignable(o, readerType) || types.isAssignable(o, clobType))) {
|
||||||
|
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "@JdbcMapper.Clob only valid for String, Clob, Reader", specialParam.delegate);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end special behavior
|
// end special behavior
|
||||||
|
@ -96,33 +96,33 @@ public class SimpleSQLChecker implements SQLChecker {
|
|||||||
public Object getFakeBindParam(final VariableElement param, final Connection conn, final ArrayInList arrayInList) throws SQLException {
|
public Object getFakeBindParam(final VariableElement param, final Connection conn, final ArrayInList arrayInList) throws SQLException {
|
||||||
final TypeMirror o = param.asType();
|
final TypeMirror o = param.asType();
|
||||||
// special behavior
|
// special behavior
|
||||||
if (param instanceof InListVariableElement) {
|
if (param instanceof SpecialVariableElement) {
|
||||||
final TypeMirror componentType;
|
final SpecialVariableElement specialParam = (SpecialVariableElement) param;
|
||||||
if (o.getKind() == TypeKind.ARRAY) {
|
switch (specialParam.specialType) {
|
||||||
componentType = ((ArrayType) o).getComponentType();
|
case IN_LIST: {
|
||||||
} else if (o.getKind() == TypeKind.DECLARED && types.isAssignable(o, collectionType)) {
|
final TypeMirror componentType;
|
||||||
final DeclaredType dt = (DeclaredType) o;
|
if (o.getKind() == TypeKind.ARRAY) {
|
||||||
componentType = dt.getTypeArguments().get(0);
|
componentType = ((ArrayType) o).getComponentType();
|
||||||
} else {
|
} else if (o.getKind() == TypeKind.DECLARED && types.isAssignable(o, collectionType)) {
|
||||||
getMessager().printMessage(Diagnostic.Kind.MANDATORY_WARNING, "invalid in-list-variable type, returning null", ((InListVariableElement) param).delegate);
|
final DeclaredType dt = (DeclaredType) o;
|
||||||
return null;
|
componentType = dt.getTypeArguments().get(0);
|
||||||
}
|
} else {
|
||||||
if (types.isAssignable(componentType, numberType)) {
|
getMessager().printMessage(Diagnostic.Kind.MANDATORY_WARNING, "invalid in-list-variable type, returning null", ((SpecialVariableElement) param).delegate);
|
||||||
return arrayInList.toArray(conn, true, new Long[]{0L}); // todo: not quite right, oh well for now
|
return null;
|
||||||
} else if (types.isAssignable(componentType, stringType) || types.isAssignable(componentType, enumType)) {
|
}
|
||||||
return arrayInList.toArray(conn, false, new String[]{defaultString});
|
if (types.isAssignable(componentType, numberType)) {
|
||||||
} else {
|
return arrayInList.toArray(conn, true, new Long[]{0L}); // todo: not quite right, oh well for now
|
||||||
getMessager().printMessage(Diagnostic.Kind.MANDATORY_WARNING, "invalid in-list-variable type, returning null", ((InListVariableElement) param).delegate);
|
} else if (types.isAssignable(componentType, stringType) || types.isAssignable(componentType, enumType)) {
|
||||||
return null;
|
return arrayInList.toArray(conn, false, new String[]{defaultString});
|
||||||
}
|
} else {
|
||||||
}
|
getMessager().printMessage(Diagnostic.Kind.MANDATORY_WARNING, "invalid in-list-variable type, returning null", ((SpecialVariableElement) param).delegate);
|
||||||
final JdbcMapper.Blob blob = param.getAnnotation(JdbcMapper.Blob.class);
|
return null;
|
||||||
if (blob != null) {
|
}
|
||||||
return new ByteArrayInputStream(new byte[1]);
|
}
|
||||||
} else {
|
case BLOB:
|
||||||
final JdbcMapper.Clob clob = param.getAnnotation(JdbcMapper.Clob.class);
|
return new ByteArrayInputStream(new byte[1]);
|
||||||
if (clob != null) {
|
case CLOB:
|
||||||
return new StringReader(defaultString);
|
return new StringReader(defaultString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end special behavior
|
// end special behavior
|
||||||
|
@ -9,12 +9,26 @@ import java.util.Set;
|
|||||||
/**
|
/**
|
||||||
* Created by mopar on 6/1/17.
|
* Created by mopar on 6/1/17.
|
||||||
*/
|
*/
|
||||||
class InListVariableElement implements VariableElement {
|
class SpecialVariableElement implements VariableElement {
|
||||||
|
|
||||||
|
enum SpecialType {
|
||||||
|
IN_LIST,
|
||||||
|
CLOB,
|
||||||
|
BLOB,
|
||||||
|
}
|
||||||
|
|
||||||
final VariableElement delegate;
|
final VariableElement delegate;
|
||||||
|
final SpecialType specialType;
|
||||||
|
final String blobStringCharset;
|
||||||
|
|
||||||
InListVariableElement(final VariableElement delegate) {
|
SpecialVariableElement(final VariableElement delegate, final SpecialType specialType) {
|
||||||
|
this(delegate, specialType, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
SpecialVariableElement(final VariableElement delegate, final SpecialType specialType, final String blobStringCharset) {
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
|
this.specialType = specialType;
|
||||||
|
this.blobStringCharset = blobStringCharset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -85,4 +99,11 @@ class InListVariableElement implements VariableElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//IFJAVA8_END
|
//IFJAVA8_END
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "InListVariableElement{" +
|
||||||
|
"delegate=" + delegate +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.moparisthebest.jdbc.codegen;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
|
import static com.moparisthebest.jdbc.codegen.JdbcMapperProcessor.paramPattern;
|
||||||
|
import static org.junit.Assert.assertArrayEquals;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class ParamPatternTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPattern() {
|
||||||
|
testMatch("{personNo}", null, null, null, null, null, null, "personNo");
|
||||||
|
testMatch("{last_name IN lastNames}", "last_name IN ", "last_name", "IN ", null, null, null, "lastNames");
|
||||||
|
testMatch("{last_name not in lastNames}", "last_name not in ", "last_name", "not in ", "not ", null, null, "lastNames");
|
||||||
|
testMatch("{clob:comment}", null, null, null, null, "clob:", null, "comment");
|
||||||
|
testMatch("{clob: comment}", null, null, null, null, "clob: ", null, "comment");
|
||||||
|
testMatch("{blob: comment}", null, null, null, null, "blob: ", null, "comment");
|
||||||
|
testMatch("{Blob: comment}", null, null, null, null, "Blob: ", null, "comment");
|
||||||
|
testMatch("{blob:utf-16:comment}", null, null, null, null, "blob:utf-16:", "utf-16:", "comment");
|
||||||
|
String blobCharset = "utf-16:";
|
||||||
|
assertEquals("utf-16", blobCharset.substring(0, blobCharset.indexOf(':')).trim());
|
||||||
|
blobCharset = "utf-16 : ";
|
||||||
|
assertEquals("utf-16", blobCharset.substring(0, blobCharset.indexOf(':')).trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void testMatch(final String sql, final String... expected) {
|
||||||
|
final Matcher bindParamMatcher = paramPattern.matcher(sql);
|
||||||
|
while (bindParamMatcher.find()) {
|
||||||
|
final String[] matches = new String[bindParamMatcher.groupCount()];
|
||||||
|
for (int x = 0; x < matches.length; )
|
||||||
|
matches[x] = bindParamMatcher.group(++x);
|
||||||
|
//System.out.println(bindParamMatcher.group() + ": " + java.util.Arrays.toString(matches));
|
||||||
|
assertArrayEquals(bindParamMatcher.group(), expected, matches);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -42,8 +42,8 @@ public interface PersonDAO extends JdbcMapper {
|
|||||||
@JdbcMapper.SQL("UPDATE person SET first_name = {firstName} WHERE person_no = {personNo}")
|
@JdbcMapper.SQL("UPDATE person SET first_name = {firstName} WHERE person_no = {personNo}")
|
||||||
void setFirstNameBlob(byte[] firstName, long personNo) throws SQLException;
|
void setFirstNameBlob(byte[] firstName, long personNo) throws SQLException;
|
||||||
|
|
||||||
@JdbcMapper.SQL("UPDATE person SET first_name = {firstName} WHERE person_no = {personNo}")
|
@JdbcMapper.SQL("UPDATE person SET first_name = {blob:firstName} WHERE person_no = {personNo}")
|
||||||
void setFirstNameBlob(@JdbcMapper.Blob String firstName, long personNo) throws SQLException;
|
void setFirstNameBlob(String firstName, long personNo) throws SQLException;
|
||||||
|
|
||||||
@JdbcMapper.SQL("SELECT person_no FROM person WHERE last_name = {lastName}")
|
@JdbcMapper.SQL("SELECT person_no FROM person WHERE last_name = {lastName}")
|
||||||
long getPersonNo(String lastName) throws SQLException;
|
long getPersonNo(String lastName) throws SQLException;
|
||||||
|
@ -42,8 +42,8 @@ public interface PrestoPersonDAO extends PersonDAO {
|
|||||||
@JdbcMapper.SQL("UPDATE person SET first_name = {firstName} WHERE person_no = {personNo}")
|
@JdbcMapper.SQL("UPDATE person SET first_name = {firstName} WHERE person_no = {personNo}")
|
||||||
void setFirstNameBlob(byte[] firstName, long personNo) throws SQLException;
|
void setFirstNameBlob(byte[] firstName, long personNo) throws SQLException;
|
||||||
|
|
||||||
@JdbcMapper.SQL("UPDATE person SET first_name = {firstName} WHERE person_no = {personNo}")
|
@JdbcMapper.SQL("UPDATE person SET first_name = {blob:firstName} WHERE person_no = {personNo}")
|
||||||
void setFirstNameBlob(@JdbcMapper.Blob String firstName, long personNo) throws SQLException;
|
void setFirstNameBlob(String firstName, long personNo) throws SQLException;
|
||||||
|
|
||||||
@JdbcMapper.SQL("SELECT person_no FROM person WHERE last_name = {lastName}")
|
@JdbcMapper.SQL("SELECT person_no FROM person WHERE last_name = {lastName}")
|
||||||
long getPersonNo(String lastName) throws SQLException;
|
long getPersonNo(String lastName) throws SQLException;
|
||||||
|
Loading…
Reference in New Issue
Block a user