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 {
|
switch t := c.SQLType.Name; t {
|
||||||
case Bool:
|
case Bool:
|
||||||
res = TinyInt
|
res = TinyInt
|
||||||
|
c.Length = 1
|
||||||
case Serial:
|
case Serial:
|
||||||
c.IsAutoIncrement = true
|
c.IsAutoIncrement = true
|
||||||
c.IsPrimaryKey = 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.SQLType.IsText() {
|
||||||
if col.Default != "" {
|
if col.Default != "" {
|
||||||
col.Default = "'" + col.Default + "'"
|
col.Default = "'" + col.Default + "'"
|
||||||
}else{
|
} else {
|
||||||
if col.DefaultIsEmpty {
|
if col.DefaultIsEmpty {
|
||||||
col.Default = "''"
|
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.
|
// 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
|
// 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) {
|
func (session *Session) InsertOne(bean interface{}) (int64, error) {
|
||||||
err := session.newDb()
|
err := session.newDb()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue