diff options
| author | 2022-08-05 23:00:28 +0200 | |
|---|---|---|
| committer | 2022-08-05 23:00:45 +0200 | |
| commit | 4c492de0f8fef67c41855bd503862874c6a2adce (patch) | |
| tree | 62ed1463261ddfc6241987ca7573f00a306b290f /errors.zig | |
| parent | move Text in sqlite.zig (diff) | |
| download | zig-sqlite-4c492de0f8fef67c41855bd503862874c6a2adce.tar.gz zig-sqlite-4c492de0f8fef67c41855bd503862874c6a2adce.tar.xz zig-sqlite-4c492de0f8fef67c41855bd503862874c6a2adce.zip | |
move versionGreaterThanOrEqualTo in sqlite.zig
We will need it later on.
Diffstat (limited to 'errors.zig')
| -rw-r--r-- | errors.zig | 6 |
1 files changed, 2 insertions, 4 deletions
| @@ -3,6 +3,8 @@ const mem = std.mem; | |||
| 3 | 3 | ||
| 4 | const c = @import("c.zig").c; | 4 | const c = @import("c.zig").c; |
| 5 | 5 | ||
| 6 | const versionGreaterThanOrEqualTo = @import("sqlite.zig").versionGreaterThanOrEqualTo; | ||
| 7 | |||
| 6 | pub const SQLiteExtendedIOError = error{ | 8 | pub const SQLiteExtendedIOError = error{ |
| 7 | SQLiteIOErrRead, | 9 | SQLiteIOErrRead, |
| 8 | SQLiteIOErrShortRead, | 10 | SQLiteIOErrShortRead, |
| @@ -127,10 +129,6 @@ pub const Error = SQLiteError || | |||
| 127 | SQLiteExtendedReadOnlyError || | 129 | SQLiteExtendedReadOnlyError || |
| 128 | SQLiteExtendedConstraintError; | 130 | SQLiteExtendedConstraintError; |
| 129 | 131 | ||
| 130 | fn versionGreaterThanOrEqualTo(major: u8, minor: u8, patch: u8) bool { | ||
| 131 | return c.SQLITE_VERSION_NUMBER >= @as(u32, major) * 1000000 + @as(u32, minor) * 1000 + @as(u32, patch); | ||
| 132 | } | ||
| 133 | |||
| 134 | pub fn errorFromResultCode(code: c_int) Error { | 132 | pub fn errorFromResultCode(code: c_int) Error { |
| 135 | // These errors are only available since 3.22.0. | 133 | // These errors are only available since 3.22.0. |
| 136 | if (comptime versionGreaterThanOrEqualTo(3, 22, 0)) { | 134 | if (comptime versionGreaterThanOrEqualTo(3, 22, 0)) { |