serversqlexecutorutils.java

来自「《j2ee开发全程实录》随书源码」· Java 代码 · 共 55 行

JAVA
55
字号
package com.cownew.PIS.framework.server.helper;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.cownew.PIS.framework.common.services.ISQLExecutor;

public class ServerSQLExecutorUtils
{
	public static ResultSet executeQuery(String sql, Object[] params)
			throws SQLException
	{
		ISQLExecutor sqle = (ISQLExecutor) LocalServiceLocator.getInstance()
				.getService(ISQLExecutor.class);
		return sqle.execute(sql, params);
	}

	public static ResultSet executeQuery(String sql) throws SQLException
	{
		ISQLExecutor sqle = (ISQLExecutor) LocalServiceLocator.getInstance()
				.getService(ISQLExecutor.class);
		return sqle.execute(sql);
	}

	public static void execute(String sql, Object[] params) throws SQLException
	{
		ISQLExecutor sqle = (ISQLExecutor) LocalServiceLocator.getInstance()
				.getService(ISQLExecutor.class);
		sqle.execute(sql, params);
	}

	public static void execute(String sql) throws SQLException
	{
		ISQLExecutor sqle = (ISQLExecutor) LocalServiceLocator.getInstance()
				.getService(ISQLExecutor.class);
		sqle.execute(sql);
	}

	public static void batchExecute(String[] sql) throws SQLException
	{
		ISQLExecutor sqle = (ISQLExecutor) LocalServiceLocator.getInstance()
				.getService(ISQLExecutor.class);
		sqle.batchExecute(sql);
	}

	public static void batchExecute(String[] sqlArray, Object[][] paramsArray)
			throws SQLException
	{
		ISQLExecutor sqle = (ISQLExecutor) LocalServiceLocator.getInstance()
				.getService(ISQLExecutor.class);
		sqle.batchExecute(sqlArray, paramsArray);
	}

}

⌨️ 快捷键说明

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