private String generateRevisionSQLStatement(boolean tableExists,
			Map<String, Set<Integer>> dataSourceToUse)
	{
		StringBuffer output = new StringBuffer();

		// Statement creates table for Template Id -> Revision Id
		output.append("CREATE TABLE IF NOT EXISTS "
				+ GeneratorConstants.TABLE_TPLID_REVISIONID
				+ " ("
				+ "templateId INTEGER UNSIGNED NOT NULL,"
				+ "revisionId INTEGER UNSIGNED NOT NULL, UNIQUE(templateId, revisionId));\r\n");

		// Statement for data into templateId -> revisionId
		output.append(this.generateSQLStatementForDataInTable(dataSourceToUse,
				GeneratorConstants.TABLE_TPLID_REVISIONID));

		if (!tableExists) {
			// Create index statement if table does not exists
			output.append("CREATE INDEX revisionIdx ON "
					+ GeneratorConstants.TABLE_TPLID_REVISIONID
					+ "(revisionID);");
			output.append("\r\n");
		}

		return output.toString();
	}
private String generateRevisionSQLStatement ( boolean tableExists , Map < String , Set < Integer > > dataSourceToUse ) { StringBuffer output = new StringBuffer ( ) ; output . append ( "CREATE TABLE IF NOT EXISTS " + GeneratorConstants . TABLE_TPLID_REVISIONID + " (" + "templateId INTEGER UNSIGNED NOT NULL," + "revisionId INTEGER UNSIGNED NOT NULL, UNIQUE(templateId, revisionId));\r\n" ) ; output . append ( this . generateSQLStatementForDataInTable ( dataSourceToUse , GeneratorConstants . TABLE_TPLID_REVISIONID ) ) ; if ( ! tableExists ) { output . append ( "CREATE INDEX revisionIdx ON " + GeneratorConstants . TABLE_TPLID_REVISIONID + "(revisionID);" ) ; output . append ( "\r\n" ) ; } return output . toString ( ) ; }
Generate sql statement for table template id -> revision id

@param tableExists
if table does not exists create index for this table
@param dataSourceToUse
data source to use for sql statement generation
@return sql statement string