mirror of
				https://github.com/aclindsa/moneygo.git
				synced 2025-11-04 02:23:26 -05:00 
			
		
		
		
	securities: Allow SQL update count to be 0
MySQL reports 0 here, while sqlite reports 1. Improve the logged message while we're at it.
This commit is contained in:
		@@ -5,6 +5,7 @@ package handlers
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"log"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"net/url"
 | 
			
		||||
@@ -142,8 +143,8 @@ func UpdateSecurity(tx *Tx, s *Security) (err error) {
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if count != 1 {
 | 
			
		||||
		return errors.New("Updated more than one security")
 | 
			
		||||
	if count > 1 {
 | 
			
		||||
		return fmt.Errorf("Updated %d securities (expected 1)", count)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user