func (stmt *InsertRowStmt) Exec(db DB, row interface{}) error {
	stmt.initOnce()

	// field for setting the auto-increment value
	var field reflect.Value
	if stmt.autoIncrColumn != nil {
		rowVal := reflect.ValueOf(row)
		field = stmt.autoIncrColumn.Index.ValueRW(rowVal)
		if !field.CanSet() {
			return fmt.Errorf("cannot set auto-increment value for type %s", rowVal.Type().Name())
		}
	}

	result, err := stmt.doExec(db, row)
	if err != nil {
		return err
	}

	if field.IsValid() {
		n, err := result.LastInsertId()
		if err != nil {
			return err
		}
		// TODO: could catch a panic here if the type is not int8, 1nt16, int32, int64
		field.SetInt(n)
	}
	return nil
}
// Exec executes the insert statement using the row as arguments.
Exec executes the insert statement using the row as arguments.
// Exec executes the insert statement using the row as arguments .
func (stmt *InsertRowStmt) Exec(db DB, row interface{}) error {
	stmt.initOnce()
	var field reflect.Value
	if stmt.autoIncrColumn != nil {
		rowVal := reflect.ValueOf(row)
		field = stmt.autoIncrColumn.Index.ValueRW(rowVal)
		if !field.CanSet() {
			return fmt.Errorf("cannot set auto-increment value for type %s", rowVal.Type().Name())
		}
	}
	result, err := stmt.doExec(db, row)
	if err != nil {
		return err
	}
	if field.IsValid() {
		n, err := result.LastInsertId()
		if err != nil {
			return err
		}
		field.SetInt(n)
	}
	return nil
}
func ( stmt * InsertRowStmt ) Exec ( db DB , row interface { } ) error { stmt . initOnce ( ) var field reflect . Value if stmt . autoIncrColumn != nil { rowVal := reflect . ValueOf ( row ) field = stmt . autoIncrColumn . Index . ValueRW ( rowVal ) if ! field . CanSet ( ) { return fmt . Errorf ( " " , rowVal . Type ( ) . Name ( ) ) } } result , err := stmt . doExec ( db , row ) if err != nil { return err } if field . IsValid ( ) { n , err := result . LastInsertId ( ) if err != nil { return err } field . SetInt ( n ) } return nil }
Exec executes the insert statement using the row as arguments.
Exec executes the insert statement using the row as arguments .
// field for setting the auto-increment value // TODO: could catch a panic here if the type is not int8, 1nt16, int32, int64