mirror of
https://github.com/chuot/rdio-scanner.git
synced 2026-08-13 08:33:00 -06:00
fix: streamline error handling in migrateCalls function
This commit is contained in:
parent
b7975763cf
commit
7edf0df1ac
|
|
@ -425,8 +425,7 @@ func migrateCalls(db *Database) error {
|
|||
query = fmt.Sprintf(`SELECT COUNT(*) FROM "units" WHERE "systemId" = %d AND "unitRef" = %d`, systems[systemRef.Int32], source.Int32)
|
||||
if err = tx.QueryRow(query).Scan(&c); err == nil && c == 0 {
|
||||
query = fmt.Sprintf(`INSERT INTO "units" ("label", "systemId", "unitRef") VALUES(%d, %d, %d)`, source.Int32, systems[systemRef.Int32], source.Int32)
|
||||
|
||||
if err == nil {
|
||||
if _, err = tx.Exec(query); err != nil {
|
||||
query = fmt.Sprintf(`INSERT INTO "callUnits" ("callId", "offset", "unitRef") VALUES (%d, %d, %d)`, call.Id, 0, source.Int32)
|
||||
if _, err = tx.Exec(query); err != nil {
|
||||
log.Println(formatError(err, query))
|
||||
|
|
|
|||
Loading…
Reference in a new issue