Exemple #1
0
func (this *GenericTranslator) Translate(dmlType db.DmlType, token db.Tokener) string {
	tag := token.GetOperator()
	handle := this.tokens[tag]
	if handle != nil {
		return handle(dmlType, token, this.overrider)
	}
	panic("token " + tag + " is unknown")
}
Exemple #2
0
func (this *GenericTranslator) ColumnAlias(token db.Tokener, position int) string {
	alias := token.GetAlias()
	if alias == "" {
		if ch, ok := token.(*db.ColumnHolder); ok {
			alias = ch.GetTableAlias() + "_" + ch.GetColumn().GetName()
		} else if db.TOKEN_ALIAS != token.GetOperator() {
			alias = "COL_" + strconv.Itoa(position)
		}
	} else {
		//alias += "_" + strconv.Itoa(position) // avoids collision with reserved words
		alias = token.GetTableAlias() + "_" + alias
	}

	return alias
}