summaryrefslogtreecommitdiff
path: root/sqlite.zig (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-10-11fix typoGravatar Vincent Rischmann1-1/+1
2021-10-11fix pragma code, return value must be explicitly ignoredGravatar Vincent Rischmann1-1/+1
2021-10-06use `try` instead of `catch unreachable`Gravatar Meghan Denny1-1/+1
2021-10-06add inserting and reading test for struct BaseType supportGravatar Meghan Denny1-0/+57
2021-09-23add BaseType support for structsGravatar Meghan Denny1-0/+7
2021-09-23add iteratorAlloc and execAllocGravatar Meghan Denny1-2/+30
2021-09-23add options parameter to bind/bindFieldGravatar Meghan Denny1-9/+9
2021-09-07more minor cleanupsGravatar Vincent Rischmann1-10/+4
2021-09-07Stop using anytype in the public API.Gravatar Vincent Rischmann1-32/+52
The need for using `options: anytype` in readXYZ functions is so that they can be used both when called by `one`/`next` or `oneAlloc`/`nextAlloc`. In the first case there won't be an allocator member in the tuple, in the latter there will be. But, since the public API takes an explicit allocator argument in `oneAlloc`/`nextAlloc` there's no need to take a `anytype` options in the public API. This commit changes the public API to always use `QueryOptions`. This commit also adds a bunch of explicit comptime checks to validate the options type passed to the readXYZ functions. Especially important is checking the presence of the `allocator` field if the function requires an allocator. Finally, cleanup some stuff and reorder arguments in `readPointer`.
2021-09-04fix for ziglang/zig#9618Gravatar Vincent Rischmann1-12/+15
2021-08-31fix the compile error from readArrayGravatar Vincent Rischmann1-2/+2
2021-08-26implement reading a text column into an enum value directlyGravatar Vincent Rischmann1-0/+39
oneAlloc/nextAlloc can allocate memory so are allowed to use text backed enums.
2021-08-26implement reading an integer column into an enum value directlyGravatar Vincent Rischmann1-1/+60
one/next can't alloc so they are limited to integer values.
2021-08-26fix documentationGravatar Vincent Rischmann1-4/+2
2021-08-27sqlite: interpret database path in init flags as uriGravatar Kenta Iwasaki1-1/+1
To avoid the need for introducing multiple sqlite.Mode's for addressing all the different possible ways one may initialize a SQLite database, enable the flag SQLITE_OPEN_URI by default. This allows for initialization options which are not addressed by InitFlags as of yet, such as the option to initialize a shared in-memory SQLite database instance that may be shared across connections in the same address space, to be set via. URI query parameters. e.g. sqlite.Db.init({ .mode = .{ .File = "file:hello.db?mode=memory&cache=shared" }, .open_flags = .{ .create = true, .write = true }, .threading_mode = .MultiThread, });
2021-08-26sqlite: expose c import, add 'shared_cache' to init flagsGravatar Kenta Iwasaki1-1/+10
Expose the C import to sqlite.h. Making a separate call to @cImport outside of the library will cause Zig to regenerate all definitions in sqlite.h. The regenerated definitions (i.e. structs, enums) would not be equivalent to the definitions imported in by this library. This causes problems in the case one wants to manually wrap SQLite structs, pointers, and enums with the helpers provided in this library. Added 'shared_cache' to init flags in order to allow having the same backing table and statement cache shared amongst all connections pointed to the same database file.
2021-08-24dry up the updated constraint checkGravatar Meghan Denny1-14/+11
2021-08-24fix type constraint checks for container and non-container typesGravatar Meghan Denny1-2/+18
2021-08-24enum tests now pass without orelse in readGravatar Meghan Denny1-1/+1
2021-08-24fix bind indexGravatar Meghan Denny1-2/+2
2021-08-23tests- add enum field casesGravatar Meghan Denny1-12/+31
2021-08-23tests- use select * when pulling into a structGravatar Meghan Denny1-2/+2
2021-08-23add support for enum fields and lay groundwork for #39Gravatar Meghan Denny1-1/+21
2021-08-11update tests for new use of `Db.init`Gravatar Meghan Denny1-6/+2
2021-08-11adding allocator to Db.QueryOptions was a mistakeGravatar Meghan Denny1-1/+0
2021-08-09move the documentation to Db.openBlob since that is the method user will callGravatar Vincent Rischmann1-19/+26
2021-08-09clarify Blob.openGravatar Vincent Rischmann1-0/+1
2021-08-09document the ZeroBlob typeGravatar Vincent Rischmann1-0/+17
2021-08-09clarify the OpenFlagsGravatar Vincent Rischmann1-0/+5
2021-08-09clarify Mode documentationGravatar Vincent Rischmann1-0/+4
2021-08-09clarify bind marker len compile errorGravatar Meghan Denny1-1/+4
2021-08-09options asks for `allocator` field but its not thereGravatar Meghan Denny1-0/+1
2021-08-09iterator- pass along options objectGravatar Meghan Denny1-1/+1
2021-08-09make `init` return a Self instead of updating a pointerGravatar Meghan Denny1-3/+3
2021-08-02modify exec to take a QueryOptionsGravatar Vincent Rischmann1-21/+47
Fixes #35
2021-06-25fix 'unused variable' errorsGravatar Vincent Rischmann1-6/+1
2021-06-25fix 'redundant comptile' errorGravatar Vincent Rischmann1-2/+2
2021-06-25fix 'unused function parameter' errorGravatar Vincent Rischmann1-0/+5
2021-05-30set the eval branch quota in the return type blockGravatar Vincent Rischmann1-5/+10
`prepare` and `prepareWithDiags` parse the query at comptime in the return type definition. This exceeds the branch quota since https://github.com/ziglang/zig/commit/b11ac9c5bfb4048eb4aa561f8b3b058a76787f7e. Use a block and `@setEvalBranchQuota` to work around this. Fixes #30.
2021-05-09all: fix tests for latest zigGravatar Vincent Rischmann1-77/+77
2021-05-03attempt to make the threading mode error clearerGravatar Vincent Rischmann1-1/+1
2021-04-27workaround compiler bugGravatar Vincent Rischmann1-3/+9
This workaround allows one to write this: const Foobar = struct { foo: usize, bar: []const u8, }; const row = try stmt.one(Foobar); Where the first field in the struct (here `foo`) is either an integer type, a float type or a boolean. Moving the first field of this type to second position resolves the bug. This is because readInt, readFloat and readBool have an empty error set and cause this bug to trigger. Removing the error altogether also triggers the bug so we define an explicit error set. If we actually want to return an error from these functions we'll simply remove the workaround. See https://github.com/ziglang/zig/issues/5149
2021-04-23fix error nameGravatar Vincent Rischmann1-1/+1
2021-04-23Allow reading into static size arrays as long as size matchesGravatar daurnimator1-11/+12
2021-04-17improve logs in Statement.deinit and Statement.resetGravatar Vincent Rischmann1-3/+6
2021-04-17fix DetailedError and Diagnostics formattingGravatar Vincent Rischmann1-4/+8
2021-04-17replace the pragma argument with a nullable stringGravatar Vincent Rischmann1-18/+15
2021-04-17fix documentationGravatar Vincent Rischmann1-1/+1
2021-02-27simplify iterator usage in code and docGravatar Vincent Rischmann1-10/+5
2021-02-27add DiagnosticsGravatar Vincent Rischmann1-11/+130