bug fixed
This commit is contained in:
parent
2373ec2e0b
commit
146d5db5ea
3
mysql.go
3
mysql.go
|
@ -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 = "''"
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue