bug fixed

This commit is contained in:
Lunny Xiao 2014-02-18 14:10:51 +08:00
parent 2373ec2e0b
commit 146d5db5ea
2 changed files with 3 additions and 2 deletions

View File

@ -111,6 +111,7 @@ func (db *mysql) SqlType(c *Column) string {
switch t := c.SQLType.Name; t {
case Bool:
res = TinyInt
c.Length = 1
case Serial:
c.IsAutoIncrement = true
c.IsPrimaryKey = true
@ -259,7 +260,7 @@ func (db *mysql) GetColumns(tableName string) ([]string, map[string]*Column, err
if col.SQLType.IsText() {
if col.Default != "" {
col.Default = "'" + col.Default + "'"
}else{
} else {
if col.DefaultIsEmpty {
col.Default = "''"
}

View File

@ -2627,7 +2627,7 @@ func (session *Session) innerInsert(bean interface{}) (int64, error) {
// Method InsertOne insert only one struct into database as a record.
// The in parameter bean must a struct or a point to struct. The return
// parameter is lastInsertId and error
// parameter is inserted and error
func (session *Session) InsertOne(bean interface{}) (int64, error) {
err := session.newDb()
if err != nil {