Update the width/height of image files based on the size field in ResultSet. - Java java.sql

Java examples for java.sql:ResultSet

Description

Update the width/height of image files based on the size field in ResultSet.

Demo Code


//package com.java2s;

import java.sql.*;

public class Main {
    /**//from w w w  .  j ava 2 s .c om
     * Update the width/height of image files based on the size field.
     */
    static void updateWidthAndHeight(ResultSet rs) throws Exception {
        String size = rs.getString("size");
        String width = size.split("x")[0];
        String height = size.split("x")[1];
        String filename = rs.getString("filename");
        rs.updateString("width", width);
        rs.updateString("height", height);
        rs.updateRow();
        System.out.println("Updated: " + filename + " (" + size + ") to w="
                + width + ", h=" + height);
    }
}

Related Tutorials