All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.ucanaccess.jdbc.Execute Maven / Gradle / Ivy

/*
Copyright (c) 2012 Marco Amadei.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package net.ucanaccess.jdbc;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;

public class Execute extends AbstractExecute {
	public Execute(UcanaccessPreparedStatement statement) {
		super(statement);
	}
	
	public Execute(UcanaccessStatement statement, String sql) {
		super(statement, sql);
	}
	
	public Execute(UcanaccessStatement statement, String sql,
			int autoGeneratedKeys) {
		super(statement, sql, autoGeneratedKeys);
	}
	
	public Execute(UcanaccessStatement statement, String sql, int[] indexes) {
		super(statement, sql, indexes);
	}
	
	public Execute(UcanaccessStatement statement, String sql,
			String[] columnNames) {
		super(statement, sql, columnNames);
	}
	
	public boolean execute() throws SQLException {
		return (Boolean) executeBase();
	}
	
	@Override
	public Object executeWrapped() throws SQLException {
		Statement w = super.getWrappedStatement();
		switch (commandType) {
		case PREPARED_STATEMENT:
			return ((PreparedStatement) w).execute();
		case NO_ARGUMENTS:
			return w.execute(sql);
		case WITH_COLUMNS_NAME:
			return w.execute(sql, columnNames);
		case WITH_AUTO_GENERATED_KEYS:
			return w.execute(sql, autoGeneratedKeys);
		case WITH_INDEXES:
			return w.execute(sql, indexes);
		default:
			return false;
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy