Repository navigation
Releases
Releases · elliotchance/vsql-swift
v1.1.2
v1.1.1
VSQL: Update to vsql v1.8.61 and support INTERVAL in custom functions…
v1.1.0
VSQL: Add custom functions and virtual tables (#7) Connection.createFunction registers a Swift closure as the body of an SQL function, with the same CREATE FUNCTION ... LANGUAGE C NO SQL EXTERNAL as VSQLCreateFunction. The closure gets the arguments as FunctionArguments (Values, or any SQLDecodable with get), and returns any SQLEncodable (nil is NULL). Connection.createVirtualTable registers a closure that adds the rows of a CREATE VIRTUAL TABLE to a VirtualTableBatch, until it calls end(). A thrown SQLError fails the statement with its SQLSTATE, and any other error with 38000. Each argument is described with VSQLDescribeArgument and decoded like a column. A truncated argument is got again with a buffer of its whole length. A datetime result or column value is formatted for the type it's cast to (the return type from RETURNS, or the column types from a prepared SELECT of the table), since a string with a UTC offset can't be cast to a DATE or TIME. This updates the amalgamation to vsql v1.8.45, which has the new statements and VSQLDescribeArgument, and keeps its VSQL_VERSION file. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
v1.0.3
VSQL: Add connection options and update to vsql v1.8.38 (#8) ConnectionOptions sets libvsql's SQL_ATTR_VSQL_* connection attributes (the lock timeout, the CREATE INDEX timeout, the default isolation level, the cache size, the page size and F_FULLFSYNC) before the connection is established. Each is an Optional, so nil is vsql's default and 0 can still be set. A transaction without an isolation level uses the isolationLevel option, if it's set. libvsql now rejects a binary parameter with a length of 0 (07001), so an empty binary value is sent as one NUL byte with SQL_NTS. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
v1.0.2
ios: Support iOS (#4) The C that V generates for Apple platforms includes three headers that the iOS SDK doesn't have (sys/random.h, sys/ptrace.h) or that are an error on iOS (mach/mach_vm.h). Sources/CVSQL/ios has stand-ins for them, which are only on the header search path for iOS. Every function that libvsql calls is in the iOS libSystem, and the garbage collector already leaves out the non-public exception API on iOS. CI runs the tests on an iOS simulator, in debug and release. Fixes #2 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
v1.0.1
tests: Check that the tests cover every line (#3) scripts/check-coverage.swift reads the coverage JSON from swift test --enable-code-coverage and fails if a line of Sources/VSQL isn't covered, listing the lines. A Coverage job runs it on Linux. To get to 100%, the paths that can't happen were restructured rather than excluded: the read loops no longer end with an unreachable return, allocEnv and the Library version use check and try!, invalid UTF-8 from libvsql is decoded lossily, and Value.parse throws the column's VSQLError itself. The rest are tested in CoverageTests, with bad handles for the errors that only libvsql can return, and Decodable types that use every part of the Decoder protocols. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
v1.0.0
Add the VSQL package (#1) VSQL is the Swift equivalent of vsql-rust, vsql-go and vsql-python, with libvsql compiled into the package (the CVSQL target) from the v1.8.2 amalgamation. Connection follows the shape of the Swift database libraries: execute/query/queryRow/queryValue with variadic arguments, a cursor for reading rows one at a time, rows that decode as any Decodable, and closure-based transactions and savepoints that commit when the closure returns and roll back when it throws. A dependency can't have unsafe flags, so the C is compiled through vsql.c, which turns off its warnings with pragmas instead of -w, and renames the declarations that conflict with the Darwin module (SwiftPM compiles C with clang modules on Apple platforms). CI runs the tests on Linux, macOS and Windows, with and without optimizations. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>