/** * All where column methods delegate to this one. */ protected void whereObject(Column col, Object val, int metaType) throws SQLException { flush(col, val, metaType, false); }
/** * All where column methods delegate to this one. */ protected void whereObject(Column col, Object val, int metaType) throws SQLException { flush(col, val, metaType, false); }
/** * All where column methods delegate to this one. */ protected void whereObject(Column col, Object val, int metaType) throws SQLException { flush(col, val, metaType, false); }
/** * All where column methods delegate to this one. */ protected void whereObject(Column col, Object val, int metaType) throws SQLException { flush(col, val, metaType, false); }
/** * All where column methods delegate to this one. */ protected void whereObject(Column col, Object val, int metaType) throws SQLException { flush(col, val, metaType, false); }
private void flushSingleRow(RowImpl row, PreparedStatement ps) throws SQLException { row.flush(ps, _dict, _store); int count = ps.executeUpdate(); if (count != 1) { Object failed = row.getFailedObject(); if (failed != null) _exceptions.add(new OptimisticException(failed)); else if (row.getAction() == Row.ACTION_INSERT) throw new SQLException(_loc.get("update-failed-no-failed-obj", String.valueOf(count), row.getSQL(_dict)).getMessage()); } }
/** * All set column methods delegate to this one. Set the given object * unless this is an insert and the given column is auto-assigned. */ protected void setObject(Column col, Object val, int metaType, boolean overrideDefault) throws SQLException { // never set auto increment columns and honor column defaults if (_action == ACTION_INSERT) { if (col.isAutoAssigned()) { // OPENJPA-349: validate because this can be the only column setValid(true); return; } if (!overrideDefault && val == null && col.getDefaultString() != null) return; } flush(col, val, metaType, true); }
/** * All set column methods delegate to this one. Set the given object * unless this is an insert and the given column is auto-assigned. */ protected void setObject(Column col, Object val, int metaType, boolean overrideDefault) throws SQLException { // never set auto increment columns and honor column defaults if (_action == ACTION_INSERT) { if (col.isAutoAssigned()) { // OPENJPA-349: validate because this can be the only column setValid(true); return; } if (!overrideDefault && val == null && col.getDefaultString() != null) return; } flush(col, val, metaType, true); }
/** * All set column methods delegate to this one. Set the given object * unless this is an insert and the given column is auto-assigned. */ protected void setObject(Column col, Object val, int metaType, boolean overrideDefault) throws SQLException { // never set auto increment columns and honor column defaults if (_action == ACTION_INSERT) { if (col.isAutoAssigned()) { // OPENJPA-349: validate because this can be the only column setValid(true); return; } if (!overrideDefault && val == null && col.getDefaultString() != null) return; } flush(col, val, metaType, true); }
/** * All set column methods delegate to this one. Set the given object * unless this is an insert and the given column is auto-assigned. */ protected void setObject(Column col, Object val, int metaType, boolean overrideDefault) throws SQLException { // never set auto increment columns and honor column defaults if (_action == ACTION_INSERT) { if (col.isAutoAssigned()) { // OPENJPA-349: validate because this can be the only column setValid(true); return; } if (!overrideDefault && val == null && col.getDefaultString() != null) return; } flush(col, val, metaType, true); }
private void flushSingleRow(RowImpl row, PreparedStatement ps) throws SQLException { if (ps != null) row.flush(ps, _dict, _store); int count = executeUpdate(ps, row.getSQL(_dict), row); if (count != 1) { logSQLWarnings(ps); Object failed = row.getFailedObject(); if (failed != null) _exceptions.add(new OptimisticException(failed)); else if (row.getAction() == Row.ACTION_INSERT) throw new SQLException(_loc.get("update-failed-no-failed-obj", String.valueOf(count), row.getSQL(_dict)).getMessage()); } }
private void flushSingleRow(RowImpl row, PreparedStatement ps) throws SQLException { if (ps != null) row.flush(ps, _dict, _store); int count = executeUpdate(ps, row.getSQL(_dict), row); if (count != 1) { logSQLWarnings(ps); Object failed = row.getFailedObject(); if (failed != null) _exceptions.add(new OptimisticException(failed)); else if (row.getAction() == Row.ACTION_INSERT) throw new SQLException(_loc.get("update-failed-no-failed-obj", String.valueOf(count), row.getSQL(_dict)).getMessage()); } }
private void flushSingleRow(RowImpl row, PreparedStatement ps) throws SQLException { if (ps != null) row.flush(ps, _dict, _store); int count = executeUpdate(ps, row.getSQL(_dict), row); if (count != 1) { logSQLWarnings(ps); Object failed = row.getFailedObject(); if (failed != null) _exceptions.add(new OptimisticException(failed)); else if (row.getAction() == Row.ACTION_INSERT) throw new SQLException(_loc.get("update-failed-no-failed-obj", String.valueOf(count), row.getSQL(_dict)).getMessage()); } }
private void flushSingleRow(RowImpl row, PreparedStatement ps) throws SQLException { if (ps != null) row.flush(ps, _dict, _store); int count = executeUpdate(ps, row.getSQL(_dict), row); if (count != 1) { logSQLWarnings(ps); Object failed = row.getFailedObject(); if (failed != null) _exceptions.add(new OptimisticException(failed)); else if (row.getAction() == Row.ACTION_INSERT) throw new SQLException(_loc.get("update-failed-no-failed-obj", String.valueOf(count), row.getSQL(_dict)).getMessage()); } }
/** * Flush the row's values to the given prepared statement. */ public void flush(PreparedStatement stmnt, int idx, DBDictionary dict, JDBCStore store) throws SQLException { // this simple method works because the SQL is always prepared // based on the indexing of the columns in the table object -- the // same ordering we use when storing values and meta types. skip // updates when setting params for DELETEs; the updates are just there // to let us eval fk constraints int i = (getAction() == ACTION_DELETE) ? _cols.length: 0; Column col; Object val; int half = _vals.length / 2; for (; i < _vals.length; i++) { if (_vals[i] == null) continue; // we don't set null params in the WHERE clause; we use the NULL // keyword instead to satisfy sqlserver if (_vals[i] == NULL && getAction() != ACTION_INSERT && i >= half) continue; // if this is an update the vals array will be 2 x the cols // array length; it repeats for where values if (i < _cols.length) col = _cols[i]; else
/** * Flush the row's values to the given prepared statement. */ public void flush(PreparedStatement stmnt, int idx, DBDictionary dict, JDBCStore store) throws SQLException { // this simple method works because the SQL is always prepared // based on the indexing of the columns in the table object -- the // same ordering we use when storing values and meta types. skip // updates when setting params for DELETEs; the updates are just there // to let us eval fk constraints int i = (getAction() == ACTION_DELETE) ? _cols.length: 0; Column col; Object val; int half = _vals.length / 2; for (; i < _vals.length; i++) { if (_vals[i] == null) continue; // we don't set null params in the WHERE clause; we use the NULL // keyword instead to satisfy sqlserver if (_vals[i] == NULL && getAction() != ACTION_INSERT && i >= half) continue; // if this is an update the vals array will be 2 x the cols // array length; it repeats for where values if (i < _cols.length) col = _cols[i]; else
/** * All set column methods delegate to this one. Set the given object * unless this is an insert and the given column is auto-assigned. */ protected void setObject(Column col, Object val, int metaType, boolean overrideDefault) throws SQLException { // never set auto increment columns and honor column defaults if (_action == ACTION_INSERT) { if (col.isAutoAssigned()) return; if (!overrideDefault && val == null && col.getDefaultString() != null) return; } if (val == null && col.isNotNull()) val = JavaSQLTypes.getEmptyValue(col.getJavaType()); flush(col, val, metaType, true); }
row.flush(stmnt, _dict, _store); try { int count = executeUpdate(stmnt, sql, row);
/** * Flush the row's values to the given prepared statement. */ public void flush(PreparedStatement stmnt, int idx, DBDictionary dict, JDBCStore store) throws SQLException { // this simple method works because the SQL is always prepared // based on the indexing of the columns in the table object -- the // same ordering we use when storing values and meta types. skip // updates when setting params for DELETEs; the updates are just there // to let us eval fk constraints int i = (getAction() == ACTION_DELETE) ? _cols.length: 0; Column col; Object val; int half = _vals.length / 2; for (; i < _vals.length; i++) { if (_vals[i] == null) continue; // we don't set null params in the WHERE clause; we use the NULL // keyword instead to satisfy sqlserver if (_vals[i] == NULL && getAction() != ACTION_INSERT && i >= half) continue; // if this is an update the vals array will be 2 x the cols // array length; it repeats for where values if (i < _cols.length) col = _cols[i]; else
/** * Flush the row's values to the given prepared statement. */ public void flush(PreparedStatement stmnt, int idx, DBDictionary dict, JDBCStore store) throws SQLException { // this simple method works because the SQL is always prepared // based on the indexing of the columns in the table object -- the // same ordering we use when storing values and meta types. skip // updates when setting params for DELETEs; the updates are just there // to let us eval fk constraints int i = (getAction() == ACTION_DELETE) ? _cols.length: 0; Column col; Object val; int half = _vals.length / 2; for (; i < _vals.length; i++) { if (_vals[i] == null) continue; // we don't set null params in the WHERE clause; we use the NULL // keyword instead to satisfy sqlserver if (_vals[i] == NULL && getAction() != ACTION_INSERT && i >= half) continue; // if this is an update the vals array will be 2 x the cols // array length; it repeats for where values if (i < _cols.length) col = _cols[i]; else