diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-19 21:43:21 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-19 21:43:21 -0500 |
| commit | b06d1851dafdcdbb2e4b43ef5c7759bbf17ad094 (patch) | |
| tree | 24ee0b7e1fad39c2ebf74a9ad391d6cfe57ce8aa | |
| parent | d821da7c0bd5a9fb66751bdcb7e8454f20d61712 (diff) | |
add db helpers
| -rw-r--r-- | Emby.Server.Implementations/Data/SqliteExtensions.cs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Data/SqliteExtensions.cs b/Emby.Server.Implementations/Data/SqliteExtensions.cs index 3dc3cec8e..014211924 100644 --- a/Emby.Server.Implementations/Data/SqliteExtensions.cs +++ b/Emby.Server.Implementations/Data/SqliteExtensions.cs @@ -137,5 +137,45 @@ namespace Emby.Server.Implementations.Data db.Execute(commandText, paramList.ToArray()); } + + public static bool IsDBNull(this IReadOnlyList<IResultSetValue> result, int index) + { + return result[index].SQLiteType == SQLiteType.Null; + } + + public static string GetString(this IReadOnlyList<IResultSetValue> result, int index) + { + return result[index].ToString(); + } + + public static bool GetBoolean(this IReadOnlyList<IResultSetValue> result, int index) + { + return result[index].ToBool(); + } + + public static int GetInt32(this IReadOnlyList<IResultSetValue> result, int index) + { + return result[index].ToInt(); + } + + public static long GetInt64(this IReadOnlyList<IResultSetValue> result, int index) + { + return result[index].ToInt64(); + } + + public static float GetFloat(this IReadOnlyList<IResultSetValue> result, int index) + { + return result[index].ToFloat(); + } + + public static DateTime GetDateTime(this IReadOnlyList<IResultSetValue> result, int index) + { + return result[index].ReadDateTime(); + } + + public static Guid GetGuid(this IReadOnlyList<IResultSetValue> result, int index) + { + return result[index].ReadGuid(); + } } } |
