// Path: src/main/java/net/ucanaccess/converters/TypesMap.java
// public static enum AccessType{
// 		BYTE,
// 		COUNTER,
// 		CURRENCY, 
// 		DATETIME,
// 		DOUBLE,
// 		GUID,
// 		INTEGER,
// 		LONG,
// 		MEMO, 
// 		NUMERIC,
// 		OLE,
// 		SINGLE,
// 		TEXT,
// 		YESNO
// }
// 
// Path: src/main/java/net/ucanaccess/jdbc/UcanaccessSQLException.java
// public class UcanaccessSQLException extends SQLException {
// 	public enum ExceptionMessages{
// 		CONCURRENT_PROCESS_ACCESS,
// 		INVALID_CREATE_STATEMENT,
// 		INVALID_INTERVAL_VALUE,
// 		INVALID_JACKCESS_OPENER,
// 		INVALID_MONTH_NUMBER, 
// 		NOT_A_VALID_PASSWORD, 
// 		ONLY_IN_MEMORY_ALLOWED, 
// 		UNPARSABLE_DATE,
// 		COMPLEX_TYPE_UNSUPPORTED, 
// 		INVALID_PARAMETER,
// 		INVALID_TYPES_IN_COMBINATION,
// 		UNSUPPORTED_TYPE
// 	}
// 	private static final long serialVersionUID = -1432048647665807662L;
// 	private Throwable cause;
// 	public UcanaccessSQLException() {
// 	}
// 	
// 	public UcanaccessSQLException(ExceptionMessages reason) {
// 		super(Logger.getMessage(reason.name()));
// 	}
// 	
// 	public UcanaccessSQLException(String reason, String SQLState) {
// 		super(Logger.getMessage(reason), SQLState);
// 	}
// 	
// 	public UcanaccessSQLException(String reason, String SQLState, int vendorCode) {
// 		super(Logger.getMessage(reason), SQLState, vendorCode);
// 	}
// 	
// 	public UcanaccessSQLException(String reason, String sqlState,
// 			int vendorCode, Throwable cause) {
// 		super(Logger.getMessage(reason), sqlState, vendorCode, cause);
// 	}
// 	
// 	public UcanaccessSQLException(String reason, String sqlState, Throwable cause) {
// 		super(Logger.getMessage(reason), sqlState, cause);
// 	}
// 	
// 	public UcanaccessSQLException(String reason, Throwable cause) {
// 		super(Logger.getMessage(reason), cause);
// 	}
// 	
// 	public UcanaccessSQLException(Throwable cause) {
// 		super( explaneCause(cause));
// 		this.cause=cause;
// 	}
// 	
// 	public static String explaneCause(Throwable cause){
// 		if(cause instanceof SQLException){
// 			SQLException se=(SQLException)cause;
// 			if(se.getErrorCode()==-5562){
// 				return cause.getMessage()+" "+Logger.getMessage(ExceptionMessages.INVALID_TYPES_IN_COMBINATION.name());
// 			}
// 		}
// 		return cause.getMessage();
// 	}
// 
// 	public Throwable getCause() {
// 		return this.cause;
// 	}
// }
// 
// Path: src/main/java/net/ucanaccess/jdbc/UcanaccessSQLException.java
// public enum ExceptionMessages{
// 	CONCURRENT_PROCESS_ACCESS,
// 	INVALID_CREATE_STATEMENT,
// 	INVALID_INTERVAL_VALUE,
// 	INVALID_JACKCESS_OPENER,
// 	INVALID_MONTH_NUMBER, 
// 	NOT_A_VALID_PASSWORD, 
// 	ONLY_IN_MEMORY_ALLOWED, 
// 	UNPARSABLE_DATE,
// 	COMPLEX_TYPE_UNSUPPORTED, 
// 	INVALID_PARAMETER,
// 	INVALID_TYPES_IN_COMBINATION,
// 	UNSUPPORTED_TYPE
// }


import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import net.ucanaccess.converters.TypesMap.AccessType;
import net.ucanaccess.ext.FunctionType;
import net.ucanaccess.jdbc.UcanaccessSQLException;
import net.ucanaccess.jdbc.UcanaccessSQLException.ExceptionMessages;
import java.math.BigDecimal;
import java.math.MathContext;
import java.sql.Timestamp;
import java.text.DateFormatSymbols;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.ParseException;
import java.text.SimpleDateFormat;
	}

	@FunctionType(namingConflict = true, functionName = "DATEADD", argumentTypes = {
			AccessType.MEMO, AccessType.LONG, AccessType.DATETIME }, returnType = AccessType.DATETIME)
	public static Date dateAdd(String intv, int vl, Date dt)
			throws UcanaccessSQLException {
		if (dt == null || intv == null)
			return null;
		Calendar cl = Calendar.getInstance();
		cl.setTime(dt);
		if (intv.equalsIgnoreCase("yyyy")) {
			cl.add(Calendar.YEAR, vl);
		} else if (intv.equalsIgnoreCase("q")) {
			cl.add(Calendar.MONTH, vl * 3);
		} else if (intv.equalsIgnoreCase("y") || intv.equalsIgnoreCase("d")) {
			cl.add(Calendar.DAY_OF_YEAR, vl);
		} else if (intv.equalsIgnoreCase("m")) {
			cl.add(Calendar.MONTH, vl);
		} else if (intv.equalsIgnoreCase("w")) {
			cl.add(Calendar.DAY_OF_WEEK, vl);
		} else if (intv.equalsIgnoreCase("ww")) {
			cl.add(Calendar.WEEK_OF_YEAR, vl);
		} else if (intv.equalsIgnoreCase("h")) {
			cl.add(Calendar.HOUR, vl);
		} else if (intv.equalsIgnoreCase("n")) {
			cl.add(Calendar.MINUTE, vl);
		} else if (intv.equalsIgnoreCase("s")) {
			cl.add(Calendar.SECOND, vl);
		} else
			throw new UcanaccessSQLException(
// Path: src/main/java/net/ucanaccess/converters/TypesMap.java
// public static enum AccessType{
// 		BYTE,
// 		COUNTER,
// 		CURRENCY, 
// 		DATETIME,
// 		DOUBLE,
// 		GUID,
// 		INTEGER,
// 		LONG,
// 		MEMO, 
// 		NUMERIC,
// 		OLE,
// 		SINGLE,
// 		TEXT,
// 		YESNO
// }
// 
// Path: src/main/java/net/ucanaccess/jdbc/UcanaccessSQLException.java
// public class UcanaccessSQLException extends SQLException {
// 	public enum ExceptionMessages{
// 		CONCURRENT_PROCESS_ACCESS,
// 		INVALID_CREATE_STATEMENT,
// 		INVALID_INTERVAL_VALUE,
// 		INVALID_JACKCESS_OPENER,
// 		INVALID_MONTH_NUMBER, 
// 		NOT_A_VALID_PASSWORD, 
// 		ONLY_IN_MEMORY_ALLOWED, 
// 		UNPARSABLE_DATE,
// 		COMPLEX_TYPE_UNSUPPORTED, 
// 		INVALID_PARAMETER,
// 		INVALID_TYPES_IN_COMBINATION,
// 		UNSUPPORTED_TYPE
// 	}
// 	private static final long serialVersionUID = -1432048647665807662L;
// 	private Throwable cause;
// 	public UcanaccessSQLException() {
// 	}
// 	
// 	public UcanaccessSQLException(ExceptionMessages reason) {
// 		super(Logger.getMessage(reason.name()));
// 	}
// 	
// 	public UcanaccessSQLException(String reason, String SQLState) {
// 		super(Logger.getMessage(reason), SQLState);
// 	}
// 	
// 	public UcanaccessSQLException(String reason, String SQLState, int vendorCode) {
// 		super(Logger.getMessage(reason), SQLState, vendorCode);
// 	}
// 	
// 	public UcanaccessSQLException(String reason, String sqlState,
// 			int vendorCode, Throwable cause) {
// 		super(Logger.getMessage(reason), sqlState, vendorCode, cause);
// 	}
// 	
// 	public UcanaccessSQLException(String reason, String sqlState, Throwable cause) {
// 		super(Logger.getMessage(reason), sqlState, cause);
// 	}
// 	
// 	public UcanaccessSQLException(String reason, Throwable cause) {
// 		super(Logger.getMessage(reason), cause);
// 	}
// 	
// 	public UcanaccessSQLException(Throwable cause) {
// 		super( explaneCause(cause));
// 		this.cause=cause;
// 	}
// 	
// 	public static String explaneCause(Throwable cause){
// 		if(cause instanceof SQLException){
// 			SQLException se=(SQLException)cause;
// 			if(se.getErrorCode()==-5562){
// 				return cause.getMessage()+" "+Logger.getMessage(ExceptionMessages.INVALID_TYPES_IN_COMBINATION.name());
// 			}
// 		}
// 		return cause.getMessage();
// 	}
// 
// 	public Throwable getCause() {
// 		return this.cause;
// 	}
// }
// 
// Path: src/main/java/net/ucanaccess/jdbc/UcanaccessSQLException.java
// public enum ExceptionMessages{
// 	CONCURRENT_PROCESS_ACCESS,
// 	INVALID_CREATE_STATEMENT,
// 	INVALID_INTERVAL_VALUE,
// 	INVALID_JACKCESS_OPENER,
// 	INVALID_MONTH_NUMBER, 
// 	NOT_A_VALID_PASSWORD, 
// 	ONLY_IN_MEMORY_ALLOWED, 
// 	UNPARSABLE_DATE,
// 	COMPLEX_TYPE_UNSUPPORTED, 
// 	INVALID_PARAMETER,
// 	INVALID_TYPES_IN_COMBINATION,
// 	UNSUPPORTED_TYPE
// }


// Path: src/main/java/net/ucanaccess/converters/Functions.java
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import net.ucanaccess.converters.TypesMap.AccessType;
import net.ucanaccess.ext.FunctionType;
import net.ucanaccess.jdbc.UcanaccessSQLException;
import net.ucanaccess.jdbc.UcanaccessSQLException.ExceptionMessages;
import java.math.BigDecimal;
import java.math.MathContext;
import java.sql.Timestamp;
import java.text.DateFormatSymbols;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.ParseException;
import java.text.SimpleDateFormat;

	}

	@FunctionType(namingConflict = true, functionName = "DATEADD", argumentTypes = {
			AccessType.MEMO, AccessType.LONG, AccessType.DATETIME }, returnType = AccessType.DATETIME)
	public static Date dateAdd(String intv, int vl, Date dt)
			throws UcanaccessSQLException {
		if (dt == null || intv == null)
			return null;
		Calendar cl = Calendar.getInstance();
		cl.setTime(dt);
		if (intv.equalsIgnoreCase("yyyy")) {
			cl.add(Calendar.YEAR, vl);
		} else if (intv.equalsIgnoreCase("q")) {
			cl.add(Calendar.MONTH, vl * 3);
		} else if (intv.equalsIgnoreCase("y") || intv.equalsIgnoreCase("d")) {
			cl.add(Calendar.DAY_OF_YEAR, vl);
		} else if (intv.equalsIgnoreCase("m")) {
			cl.add(Calendar.MONTH, vl);
		} else if (intv.equalsIgnoreCase("w")) {
			cl.add(Calendar.DAY_OF_WEEK, vl);
		} else if (intv.equalsIgnoreCase("ww")) {
			cl.add(Calendar.WEEK_OF_YEAR, vl);
		} else if (intv.equalsIgnoreCase("h")) {
			cl.add(Calendar.HOUR, vl);
		} else if (intv.equalsIgnoreCase("n")) {
			cl.add(Calendar.MINUTE, vl);
		} else if (intv.equalsIgnoreCase("s")) {
			cl.add(Calendar.SECOND, vl);
		} else
			throw new UcanaccessSQLException(
					ExceptionMessages.INVALID_INTERVAL_VALUE);