/*******************************************************************************
 * Copyright 2016, 2017 vanilladb.org contributors
 *
 * 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 org.vanilladb.core.sql.storedprocedure;

import org.vanilladb.core.remote.storedprocedure.SpResultSet;
import org.vanilladb.core.sql.Schema;

public abstract class StoredProcedureParamHelper {

	protected boolean isCommitted = true;
	private boolean isReadOnly = false;

	/**
	 * Prepare parameters for this stored procedure.
	 * 
	 * @param pars
	 *            An object array contains all parameter for this stored
	 *            procedure.
	 */
	public abstract void prepareParameters(Object... pars);

	public abstract SpResultSet createResultSet();

	public static StoredProcedureParamHelper DefaultParamHelper() {
		return new StoredProcedureParamHelper() {

			@Override
			public void prepareParameters(Object... pars) {
				// do nothing
			}

			@Override
			public SpResultSet createResultSet() {
				// Return the result
				Schema sch = new Schema();
				SpResultRecord rec = new SpResultRecord();
				return new SpResultSet(isCommitted, sch, rec);
			}
		};
	}
	
	protected void setReadOnly(boolean isReadOnly) {
		this.isReadOnly = isReadOnly;
	}
	
	public boolean isReadOnly() {
		return isReadOnly;
	}

	public void setCommitted(boolean b) {
		isCommitted = b;
	}

	public boolean isCommitted() {
		return isCommitted;
	}
}

@@ -992,23 +992,21 @@
 %7B%0D%0A%0D%0A%09pr
-otec
+iva
 te
-d
  boolean
@@ -1769,16 +1769,18 @@
 ommitted
+()
 , sch, r
@@ -1896,69 +1896,68 @@
 %09%7D%0D%0A
-%09
 %0D%0A%09
-public boolean isReadOnly() %7B%0D%0A%09%09return isReadOnly
+void setCommitted(boolean b) %7B%0D%0A%09%09isCommitted = b
 ;%0D%0A%09%7D%0D%0A
+%09
 %0D%0A%09p
@@ -1966,57 +1966,51 @@
 lic 
-void setCommitted(boolean b) %7B%0D%0A%09%09isCommitted = b
+boolean isReadOnly() %7B%0D%0A%09%09return isReadOnly
 ;%0D%0A%09

Update the visibility of API of StoredProcedureParamHelper