Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package base.jee.api.sql.util;
 
 public class SqlFilter {

Table creation statements so they are compatible with either MySQL or with SQLite.

Parameters:
sql
type 0 = SQLite, 1 = MySQL
Returns:
	public static String sqlFilter(String sqlint type) {
		if(type == 1) {
			return sql.replaceAll("autoincrement""auto_increment");
		}
		if(type == 0) {
			sql = sql.replaceAll("varchar\\(\\d+\\)""text");
			sql = sql.replaceAll("char\\(\\d+\\)""text");
			sql = sql.replaceAll("\\bbigint\\b""integer");
			sql = sql.replaceAll(" DEFAULT CHARSET=utf8 ENGINE=innodb""");
			sql = sql.replaceAll(" ENGINE=InnoDB DEFAULT CHARSET=utf8""");
			sql = sql.replaceAll(" character set latin1 "" ");
		}
		return sql;
	}
New to GrepCode? Check out our FAQ X