()
| 421 | } |
| 422 | |
| 423 | func (this *SQLiteFileListDB) Close() error { |
| 424 | if this.isClosed { |
| 425 | return nil |
| 426 | } |
| 427 | |
| 428 | this.isClosed = true |
| 429 | this.isReady = false |
| 430 | |
| 431 | if this.existsByHashStmt != nil { |
| 432 | _ = this.existsByHashStmt.Close() |
| 433 | } |
| 434 | if this.insertStmt != nil { |
| 435 | _ = this.insertStmt.Close() |
| 436 | } |
| 437 | if this.selectByHashStmt != nil { |
| 438 | _ = this.selectByHashStmt.Close() |
| 439 | } |
| 440 | if this.selectHashListStmt != nil { |
| 441 | _ = this.selectHashListStmt.Close() |
| 442 | } |
| 443 | if this.deleteByHashStmt != nil { |
| 444 | _ = this.deleteByHashStmt.Close() |
| 445 | } |
| 446 | if this.statStmt != nil { |
| 447 | _ = this.statStmt.Close() |
| 448 | } |
| 449 | if this.purgeStmt != nil { |
| 450 | _ = this.purgeStmt.Close() |
| 451 | } |
| 452 | if this.deleteAllStmt != nil { |
| 453 | _ = this.deleteAllStmt.Close() |
| 454 | } |
| 455 | if this.listOlderItemsStmt != nil { |
| 456 | _ = this.listOlderItemsStmt.Close() |
| 457 | } |
| 458 | |
| 459 | var errStrings []string |
| 460 | |
| 461 | if this.readDB != nil { |
| 462 | err := this.readDB.Close() |
| 463 | if err != nil { |
| 464 | errStrings = append(errStrings, err.Error()) |
| 465 | } |
| 466 | } |
| 467 | |
| 468 | if this.writeDB != nil { |
| 469 | err := this.writeDB.Close() |
| 470 | if err != nil { |
| 471 | errStrings = append(errStrings, err.Error()) |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | if len(errStrings) == 0 { |
| 476 | return nil |
| 477 | } |
| 478 | return errors.New("close database failed: " + strings.Join(errStrings, ", ")) |
| 479 | } |
| 480 |
no test coverage detected