All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.gkutiel.store.Temp.xtend Maven / Gradle / Ivy

There is a newer version: 7-RELEASE
Show newest version
package com.github.gkutiel.store

import java.lang.reflect.Field
import java.util.List

class Temp{
	def static String insert(boolean hasKey, String tableName, int valueCounts)'''
		«IF hasKey»MERGE«ELSE»INSERT«ENDIF» INTO «tableName» VALUES («FOR i : 0..valueCounts SEPARATOR ','»?«ENDFOR»)
	'''
	
	def static String table(Class c, List fs, String[] primaryKey)'''
		CREATE TABLE IF NOT EXISTS «c.simpleName» (
			obj VARCHAR(8192)
			«FOR f : fs»
				,«f.name» «Java2Sql::toSql(f.type)»
			«ENDFOR»
			«IF primaryKey != null && primaryKey.size > 0»,PRIMARY KEY («FOR i : 0..primaryKey.size - 1 SEPARATOR ','»«primaryKey.get(i)»«ENDFOR»)«ENDIF»
		)
	'''
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy