(if there has been some discussion about this already, please let me
know. searches on this list in the last 365 for either "ON DUPLICATE
KEY" or "PREPARED STATEMENT DUPLICATE KEY" yielded no relevant
discussions, but maybe there's a better search i could do. i couldn't
find anything about it in the connector j docs either, so maybe asking
here can yield some answers, or at least some commiseration.
i'm trying to prepare and bind statements a la
PreparedStatement st = conn.prepareStatement(
" INSERT INTO blah ( col1, col2 ) VALUES ( ?, ? ) " + // col1 is
prikey, let's say
" ON DUPLICATE KEY UPDATE col1 = ?, col2 = ? "
);
st.setBlah( 1, someCol1Val );
st.setBlah( 3, someCol1Val );
st.setBlah( 2, someCol2Val );
st.setBlah( 4, someCol2Val );
...
but it only seems to work under the insert conditions. note -- it
doesn't fail or throw a SQLException, etc, it just leaves things
untouched. is it supported and i'm doing something wrong, or is it
unsupported (in which case let's just agree that at least i'm not
wrong:)
jon
| Thread |
|---|
| • PreparedStatements and "ON DUPLICATE KEY UPDATE ..." | dev | 27 Aug |