Beispiel #1
0
func (this *PgUpdateBuilder) Column(update *db.Update) {
	values := update.GetValues()
	for it := values.Iterator(); it.HasNext(); {
		entry := it.Next()
		column := entry.Key.(*db.Column)
		// use only not virtual columns
		token := entry.Value.(db.Tokener)
		this.columnPart.AddAsOne(
			this.translator.ColumnName(column),
			" = ", this.translator.Translate(db.UPDATE, token))
	}
}
Beispiel #2
0
func (this *GenericTranslator) GetSqlForUpdate(update *db.Update) string {
	proc := this.CreateUpdateProcessor(update)

	// SET
	sel := tk.NewStrBuffer()
	sel.Add("UPDATE ", proc.TablePart())
	sel.Add(" SET ", proc.ColumnPart())
	// JOINS
	// sel.Add(proc.joinPart.String())
	// WHERE - conditions
	if update.GetCriteria() != nil {
		sel.Add(" WHERE ", proc.WherePart())
	}

	return sel.String()
}
Beispiel #3
0
func (this *UpdateBuilder) Where(update *db.Update) {
	criteria := update.GetCriteria()
	if criteria != nil {
		this.wherePart.Add(this.translator.Translate(db.UPDATE, criteria))
	}
}
Beispiel #4
0
func (this *UpdateBuilder) From(update *db.Update) {
	table := update.GetTable()
	alias := update.GetTableAlias()
	this.tablePart.AddAsOne(this.translator.TableName(table), " ", alias)
}