private String buildCreateTableQuery ( final IClassContainer container , final String primaryKeyField ) { final StringBuilder builder = new StringBuilder ( "CREATE TABLE IF NOT EXISTS " ) . append ( container . getExportClassName ( ) . toLowerCase ( ) ) . append ( "(\n" ) ; final String resultValues = container . getFormatSupported ( Format . SQL ) . entrySet ( ) . stream ( ) . map ( e -> "\t" + buildInsertNameTypeQuery ( e . getValue ( ) . getExportName ( ) , container ) ) . collect ( Collectors . joining ( ",\n" ) ) ; builder . append ( resultValues ) ; // Write primary key constraint return builder . append ( ",\n" ) . append ( "\tPRIMARY KEY (" ) . append ( primaryKeyField ) . append ( ")\n);\n" ) . toString ( ) ; }
Create String of Create Table Query