private String generatePageSQLStatement ( boolean tableExists , Map < String , Set < Integer > > dataSourceToUse ) { StringBuffer output = new StringBuffer ( ) ; // Statement creates table for Template Id -> Page Id output . append ( "CREATE TABLE IF NOT EXISTS " + GeneratorConstants . TABLE_TPLID_PAGEID + " (" + "templateId INTEGER UNSIGNED NOT NULL," + "pageId INTEGER UNSIGNED NOT NULL, UNIQUE(templateId, pageId));\r\n" ) ; // Statement for data into templateId -> pageId output . append ( this . generateSQLStatementForDataInTable ( dataSourceToUse , GeneratorConstants . TABLE_TPLID_PAGEID ) ) ; if ( ! tableExists ) { // Create index statement if table does not exists output . append ( "CREATE INDEX pageIdx ON " + GeneratorConstants . TABLE_TPLID_PAGEID + "(pageId);" ) ; output . append ( "\r\n" ) ; } return output . toString ( ) ; }
Generate sql statement for table template id - > page id