diff options
| author | Anthony Lavado <anthony@lavado.ca> | 2020-09-11 08:33:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-11 08:33:36 -0400 |
| commit | b198c6f4d16f3c9bf8b9f85cd3d020d6bdc39576 (patch) | |
| tree | ecf7354e65ce1c7ea9c8c1f76aec2e2664c71d29 /Emby.Server.Implementations/Data/BaseSqliteRepository.cs | |
| parent | 1d633aac0a9c9b28c216dafe5b0180922f190cc6 (diff) | |
| parent | edbd4e0db6ba7e8ba08757f74274e5c83c9660e8 (diff) | |
Merge pull request #4108 from Bond-009/PERFORMANCE
Minor performance improvements to item saving
Diffstat (limited to 'Emby.Server.Implementations/Data/BaseSqliteRepository.cs')
| -rw-r--r-- | Emby.Server.Implementations/Data/BaseSqliteRepository.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs index 8a3716380..0fb050a7a 100644 --- a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs +++ b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs @@ -143,8 +143,17 @@ namespace Emby.Server.Implementations.Data public IStatement PrepareStatement(IDatabaseConnection connection, string sql) => connection.PrepareStatement(sql); - public IEnumerable<IStatement> PrepareAll(IDatabaseConnection connection, IEnumerable<string> sql) - => sql.Select(connection.PrepareStatement); + public IStatement[] PrepareAll(IDatabaseConnection connection, IReadOnlyList<string> sql) + { + int len = sql.Count; + IStatement[] statements = new IStatement[len]; + for (int i = 0; i < len; i++) + { + statements[i] = connection.PrepareStatement(sql[i]); + } + + return statements; + } protected bool TableExists(ManagedConnection connection, string name) { |
