[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/ifooling/APIJSON/master/APIJSONORM/src/main/java/apijson/SQL.java [Back]  [Original]

/*Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.

This source code is licensed under the Apache License Version 2.0.*/


package apijson;

/**SQLJDK
 * @author Lemon
 */
public class SQL {

	public static final String JOIN = " JOIN ";
	public static final String ON = " ON ";
	public static final String OR = " OR ";
	public static final String AND = " AND ";
	public static final String NOT = " NOT ";
	public static final String AS = " AS ";
	public static final String IS = " IS ";
	public static final String NULL = " NULL ";
	public static final String IS_NOT = " IS NOT ";
	public static final String IS_NULL = " IS NULL ";
	public static final String IS_NOT_NULL = " IS NOT NULL ";

	// count (...) 
	public static final String COUNT = "count";
	public static final String SUM = "sum";
	public static final String MAX = "max";
	public static final String MIN = "min";
	public static final String AVG = "avg";

	/**
	 * isNull = true 
	 * @return {@link #isNull(boolean)}
	 */
	public static String isNull() {
		return isNull(true);
	}
	/**
	 * @param isNull
	 * @return {@link #IS} + (isNull ? "" : {@link #NOT}) + {@link #NULL};
	 */
	public static String isNull(boolean isNull) {
		return IS + (isNull ? "" : NOT) + NULL;
	}
	/**
	 * isNull = true
	 * @param s
	 * @return {@link #isNull(String, boolean)}
	 */
	public static String isNull(String s) {
		return isNull(s, true);
	}
	/**
	 * @param s
	 * @param isNull
	 * @return s + {@link #isNull(boolean)}
	 */
	public static String isNull(String s, boolean isNull) {
		return s + isNull(isNull);
	}

	/**
	 * isEmpty = true
	 * @param s
	 * @return {@link #isEmpty(String, boolean)}
	 */
	public static String isEmpty(String s) {
		return isEmpty(s, true);
	}
	/**
	 * trim = false
	 * @param s
	 * @param isEmpty
	 * @return {@link #isEmpty(String, boolean, boolean)}
	 */
	public static String isEmpty(String s, boolean isEmpty) {
		return isEmpty(s, isEmpty, false);
	}
	/**
	 * nullable = true
	 * @param s
	 * @param isEmpty >


	//search>


	public static boolean isBooleanOrNumber(String type) {
		type = StringUtil.toUpperCase(type, true);
		return type.isEmpty() || (type.endsWith("INT") && type.endsWith("POINT") == false)
				|| type.endsWith("BOOLEAN") || type.endsWith("ENUM")
				|| type.endsWith("FLOAT") || type.endsWith("DOUBLE") || type.endsWith("DECIMAL");
	}


}

Web Proxy Viewer  |  New URL  |  Original Page