checkNamedBindParameters in DBHandle seems very buggy!!
for (int i=0; i<sql.length(); ++i) {
char ch = sql.charAt(i);
switch(state) {
case 1: // state of in-string
switch(ch) {
case ':': state = 2; ch = '?'; break;
case '\'': state = 1; break;
default: sb.append(ch); break;
}
break;
case 2: // state of the parameter name
if (!Character.isJavaIdentifierPart(ch)) {
state = 0;
sb.append(ch);
namedBindParameters.put(sb1.toString(), new
Integer(idx++));
sb1.setLength(0);
} else {
sb1.append(ch);
}
break;
default: // original state
switch(ch) {
case ':': state = 2; ch = '?'; break;
case '\'': state = 1; break;
}
sb.append(ch);
break;
}
}
case 1 seems to be an "in-string" state entered by "'"
from default state. But in case 1 the termination of
the string "'" is never added to the sql string.
It's possible to enter a parametername inside a quoted
string? In the implementation it seems to be possible.
What is with a string quoted by '"'?