rs = pstmt.executeQuery();
if( rs.next() ) {
BLOB myBlob = (BLOB)rs.getBlob(1);
myBlob.putBytes(1, b);
} else {
// not in database, do insert:
PreparedStatement pstmt2 = _preparedStatements[pool][WRITE_STATE_NEW];
if (pstmt2 == null)
{
pstmt2 = _theConnection[pool].prepareStatement("INSERT INTO "+tableName+" (StateType,TypeName,UidString,ObjectState) VALUES (?,?,?,empty_blob())");
_preparedStatements[pool][WRITE_STATE_NEW] = pstmt2;
}
pstmt2.setInt(1, s);
pstmt2.setString(2, tName);
pstmt2.setString(3, objUid.stringForm());
pstmt2.executeUpdate();
_theConnection[pool].commit();
PreparedStatement pstmt3 = _preparedStatements[pool][SELECT_FOR_WRITE_STATE];
if(pstmt3 == null) {
pstmt3 = _theConnection[pool].prepareStatement("SELECT ObjectState FROM "+tableName+" WHERE UidString = ? AND TypeName = ? AND StateType = ? FOR UPDATE");
_preparedStatements[pool][SELECT_FOR_WRITE_STATE] = pstmt3;
}
pstmt3.setString(1, objUid.stringForm());
pstmt3.setString(2, tName);
pstmt3.setInt(3, s);
rs3 = pstmt3.executeQuery();
rs3.next();
BLOB myBlob = (BLOB)rs3.getBlob(1);
myBlob.putBytes(1, b);
}
_theConnection[pool].commit();
return true ;