⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 picture.java

📁 一个加密的陈旭
💻 JAVA
字号:
package net.jspcn.eric;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class Picture {
	private boolean flag = false;

	Connection connection = null;

	PreparedStatement pStatement = null;

	ArrayList<PictureVo> list = new ArrayList<PictureVo>();

	ResultSet rSet = null;

	public boolean insert(String sql) {
		connection = DBConnection.getConnection();
		try {
			pStatement = connection.prepareStatement(sql);
			if (pStatement.executeUpdate() == 1) {
				flag = true;
			}
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConnection(connection, pStatement, null);
		}
		return flag;
	}

	public ArrayList<PictureVo> selectAll(String sql) {
		connection = DBConnection.getConnection();
		try {
			pStatement = connection.prepareStatement(sql);
			rSet = pStatement.executeQuery();
			while (rSet.next()) {
			PictureVo pVo = new PictureVo();
            pVo.setP_name(rSet.getString("p_name"));
            pVo.setP_path(rSet.getString("p_path"));
            pVo.setP_time(rSet.getString("p_time"));
            pVo.setP_des(rSet.getString("p_des"));
            list.add(pVo);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}

		return list;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -