public int update(Connection conn, Entity record, Entity where) throws SQLException {
		checkConn(conn);
		if(CollectionUtil.isEmpty(record)){
			throw new SQLException("Empty entity provided!");
		}
		if(CollectionUtil.isEmpty(where)){
			//不允许做全表更新
			throw new SQLException("Empty where provided!");
		}
		
		//表名可以从被更新记录的Entity中获得，也可以从Where中获得
		String tableName = record.getTableName();
		if(StrUtil.isBlank(tableName)){
			tableName = where.getTableName();
			record.setTableName(tableName);
		}
		
		final Query query = new Query(SqlUtil.buildConditions(where), tableName);
		PreparedStatement ps = null;
		try {
			ps = dialect.psForUpdate(conn, record, query);
			return ps.executeUpdate();
		} catch (SQLException e) {
			throw e;
		} finally {
			DbUtil.close(ps);
		}
	}
public int update ( Connection conn , Entity record , Entity where ) throws SQLException { checkConn ( conn ) ; if ( CollectionUtil . isEmpty ( record ) ) { throw new SQLException ( "Empty entity provided!" ) ; } if ( CollectionUtil . isEmpty ( where ) ) { throw new SQLException ( "Empty where provided!" ) ; } String tableName = record . getTableName ( ) ; if ( StrUtil . isBlank ( tableName ) ) { tableName = where . getTableName ( ) ; record . setTableName ( tableName ) ; } final Query query = new Query ( SqlUtil . buildConditions ( where ) , tableName ) ; PreparedStatement ps = null ; try { ps = dialect . psForUpdate ( conn , record , query ) ; return ps . executeUpdate ( ) ; } catch ( SQLException e ) { throw e ; } finally { DbUtil . close ( ps ) ; } }
更新数据<br>
此方法不会关闭Connection
@param conn 数据库连接
@param record 记录
@param where 条件
@return 影响行数
@throws SQLException SQL执行异常