code: static public String safeSqlQueryIdentifier(String in) throws Exception {
  		if( null == in ) {
  			throw new Exception("Null string passed as identifier");
  		}
  		if( in.indexOf('\0') >= 0 ) {
  			throw new Exception("Null character found in identifier");
  		}
  		
  		// All quotes should be escaped
  		in = in.replace("\"", "\"\"");
  		
  		in = "\"" + in + "\"";
  
  		return in;
  	}
docs: This method converts a string into a new one that is safe for
  a SQL query. It deals with strings that are supposed to be
  identifiers.
  @param in Original string
  @return Safe string for a query.
  @throws Exception