Fixed FOR UPDATE for each dialects #290

This commit is contained in:
evalphobia 2015-08-30 20:07:18 +09:00
parent e89f74daa0
commit 693501fd60
3 changed files with 9 additions and 1 deletions

View File

@ -509,6 +509,10 @@ func (db *mssql) CreateTableSql(table *core.Table, tableName, storeEngine, chars
return sql
}
func (db *mssql) ForUpdateSql(query string) string {
return query
}
func (db *mssql) Filters() []core.Filter {
return []core.Filter{&core.IdFilter{}, &core.QuoteFilter{}}
}

View File

@ -250,6 +250,10 @@ func (db *sqlite3) DropIndexSql(tableName string, index *core.Index) string {
return fmt.Sprintf("DROP INDEX %v", quote(idxName))
}
func (db *sqlite3) ForUpdateSql(query string) string {
return query
}
/*func (db *sqlite3) ColumnCheckSql(tableName, colName string) (string, []interface{}) {
args := []interface{}{tableName}
sql := "SELECT name FROM sqlite_master WHERE type='table' and name = ? and ((sql like '%`" + colName + "`%') or (sql like '%[" + colName + "]%'))"

View File

@ -1283,7 +1283,7 @@ func (statement *Statement) genSelectSql(columnStr string) (a string) {
}
}
if statement.IsForUpdate {
a += " FOR UPDATE"
a = statement.Engine.dialect.ForUpdateSql(a)
}
return