summaryrefslogtreecommitdiff
path: root/sqlite.zig (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-12-18add a test binding an empty slice to a text columnGravatar Vincent Rischmann1-0/+67
2021-12-18always deinit the test databaseGravatar Vincent Rischmann1-0/+30
otherwise using the dbfile option won't work
2021-12-18rename argument for clarityGravatar Vincent Rischmann1-3/+3
also style consistency; variables should be snake case
2021-12-01all: replace spanZ with sliceToGravatar Vincent Rischmann1-8/+12
2021-12-01all: fix for latest Allocator interface refactorGravatar Vincent Rischmann1-44/+61
2021-11-22dynamic statement: fix documentationGravatar Vincent Rischmann1-3/+5
2021-11-22dynamic statement: document bind()Gravatar Vincent Rischmann1-0/+33
2021-11-22dynamic statement: add some testsGravatar Vincent Rischmann1-0/+98
2021-11-22dynamic statement: fix one()Gravatar Vincent Rischmann1-1/+1
2021-11-22remove smartBind/bindNamedStruct, they're not actually necessaryGravatar Vincent Rischmann1-33/+11
2021-11-22FixesGravatar Felix "xq" Queißner1-3/+36
2021-11-22A handful of tiny fixes.Gravatar Felix "xq" Queißner1-6/+6
2021-11-07savepoint: always deinit the statementsGravatar Vincent Rischmann1-0/+5
2021-10-23implement savepointGravatar Vincent Rischmann1-0/+250
2021-10-23use explicit error sets everywhereGravatar Vincent Rischmann1-11/+25
2021-10-19sqlite: move to new ParsedQuery and BindMarkerGravatar thisLight1-13/+9
2021-10-18use snake case for field namesGravatar Vincent Rischmann1-3/+3
2021-10-18make bindField clearerGravatar Vincent Rischmann1-34/+52
Be less clever with comptime reflection. This has the advantage of making the code a lot clearer, clearly identifying which case are converting an sqlite int result to an error. This also makes it easier to follow the error trace if there is an error while binding a field.
2021-10-18no need for comptimePrint hereGravatar Vincent Rischmann1-1/+1
2021-10-18improve documentation of DynamicStatementGravatar Vincent Rischmann1-27/+27
2021-10-18Db.getPragmaQuery: use comptimePrint instead of bufPrintGravatar thisLight1-7/+5
2021-10-13add the StatementType functionGravatar Vincent Rischmann1-10/+24
This function returns the type of a statement as would be returned by Db.prepare. Needed to be able to store a statement in a struct.
2021-10-13sqlite: format codeGravatar thisLight1-19/+14
2021-10-13DynamicStatement.translateError: fix typo in nameGravatar thisLight1-2/+2
2021-10-13DynamicStatement.bindField: fix incompatible if branches for optionalsGravatar thisLight1-1/+1
2021-10-13sqlite: some doc fixesGravatar thisLight1-5/+5
2021-10-13DynamicStatment: introduce original sqlite3 statement.Gravatar thisLight1-122/+442
2021-10-12test binding an optional value tooGravatar Vincent Rischmann1-1/+3
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