Example usage for org.springframework.jdbc.core ParameterizedPreparedStatementSetter ParameterizedPreparedStatementSetter

List of usage examples for org.springframework.jdbc.core ParameterizedPreparedStatementSetter ParameterizedPreparedStatementSetter

Introduction

In this page you can find the example usage for org.springframework.jdbc.core ParameterizedPreparedStatementSetter ParameterizedPreparedStatementSetter.

Prototype

ParameterizedPreparedStatementSetter

Source Link

Usage

From source file:org.dcache.chimera.FsSqlDriver.java

/**
 * Set inode's Access Control List. The inode must not have any ACLs prior to this call.
 * @param inode/* w w w  .  ja va2  s  . c om*/
 * @param acl
 */
void writeAcl(FsInode inode, RsType rsType, List<ACE> acl) {
    _jdbc.batchUpdate(
            "INSERT INTO t_acl (inumber,rs_type,type,flags,access_msk,who,who_id,ace_order) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
            acl, acl.size(), new ParameterizedPreparedStatementSetter<ACE>() {
                int order = 0;

                @Override
                public void setValues(PreparedStatement ps, ACE ace) throws SQLException {
                    ps.setLong(1, inode.ino());
                    ps.setInt(2, rsType.getValue());
                    ps.setInt(3, ace.getType().getValue());
                    ps.setInt(4, ace.getFlags());
                    ps.setInt(5, ace.getAccessMsk());
                    ps.setInt(6, ace.getWho().getValue());
                    ps.setInt(7, ace.getWhoID());
                    ps.setInt(8, order);
                    order++;
                }
            });
}