Merge branch 'master' of github.com:go-xorm/xorm

This commit is contained in:
Lunny Xiao 2014-08-28 22:53:40 +08:00
commit e9059acd4d
4 changed files with 6 additions and 4 deletions

View File

@ -373,12 +373,14 @@ func (engine *Engine) DumpAll(w io.Writer) error {
} else if col.SQLType.IsText() || col.SQLType.IsTime() {
var v = fmt.Sprintf("%s", d)
temp += ", '" + strings.Replace(v, "'", "''", -1) + "'"
} else if col.SQLType.IsBlob() /**/ {
} else if col.SQLType.IsBlob() {
if reflect.TypeOf(d).Kind() == reflect.Slice {
temp += fmt.Sprintf(", %s", engine.dialect.FormatBytes(d.([]byte)))
} else if reflect.TypeOf(d).Kind() == reflect.String {
temp += fmt.Sprintf(", '%s'", d.(string))
}
} else if col.SQLType.IsNumeric() {
temp += fmt.Sprintf(", %s", string(d.([]byte)))
} else {
s := fmt.Sprintf("%v", d)
if strings.Contains(s, ":") || strings.Contains(s, "-") {

View File

@ -168,7 +168,7 @@ where a.object_id=object_id('` + tableName + `')`
}
}
if col.SQLType.IsText() {
if col.SQLType.IsText() || col.SQLType.IsTime() {
if col.Default != "" {
col.Default = "'" + col.Default + "'"
} else {

View File

@ -228,7 +228,7 @@ func (db *mysql) GetColumns(tableName string) ([]string, map[string]*core.Column
col.IsAutoIncrement = true
}
if col.SQLType.IsText() {
if col.SQLType.IsText() || col.SQLType.IsTime() {
if col.Default != "" {
col.Default = "'" + col.Default + "'"
} else {

View File

@ -158,7 +158,7 @@ func (db *oracle) GetColumns(tableName string) ([]string, map[string]*core.Colum
col.Length = dataLen
if col.SQLType.IsText() {
if col.SQLType.IsText() || col.SQLType.IsTime() {
if col.Default != "" {
col.Default = "'" + col.Default + "'"
} else {