summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibSQL
AgeCommit message (Collapse)Author
2023-05-25LibSQL: Free heap storage when deleting rowsJelle Raaijmakers
2023-05-25LibSQL: Implement freeing heap storageJelle Raaijmakers
This allows us to free entire chains of blocks in one go.
2023-05-25LibSQL: Find free blocks when opening a database fileJelle Raaijmakers
The free block list now gets populated on opening a database file. Ideally we persist this list inside the heap itself, but for now this prevents excessive heap growth.
2023-05-25LibSQL: Keep track of free heap blocks when trimming storageJelle Raaijmakers
When overwriting existing heap storage that requires fewer blocks, make sure to free all remaining blocks so they can be reused in the future.
2023-05-25LibSQL: Reuse heap blocks when overwriting storageJelle Raaijmakers
Previously, only the first block in a chain of blocks would be overwritten while all subsequent blocks would be appended to the heap. Now we make sure to reuse all existing blocks in the chain.
2023-05-24Userland: Remove remaining users of Duration::now_realtime()kleines Filmröllchen
This is a clear sign that they want to use a UnixDateTime instead. This also adds support for placing durations and date times into SQL databases via their millisecond offset to UTC.
2023-05-09AK: Add the `Input` word to input-only buffered streamsLucas CHOLLET
This concerns both `BufferedSeekable` and `BufferedFile`.
2023-05-07LibSQL: Remove unused IODevice includeBen Wiederhake
2023-04-25LibSQL: Handle statements with malformed exists expressions correctlyTim Ledbetter
Previously, statements containing malformed exists expressions such as: `INSERT INTO t(a) VALUES (SELECT 1)`; could cause the parser to crash. The parser will now return an error message instead.
2023-04-23LibSQL: Add a note to `Serializer` about `m_heap`Jelle Raaijmakers
2023-04-23LibSQL: Use `Block::Index` everywhere; rename `pointer` to `block_index`Jelle Raaijmakers
No functional changes.
2023-04-23LibSQL: Redesign heap storage to support arbitrary amounts of dataJelle Raaijmakers
Previously, `Heap` would store serialized data in blocks of 1024 bytes regardless of the actual length. Data longer than 1024 bytes was silently truncated causing database corruption. This changes the heap storage to prefix every block with two new fields: the total data size in bytes, and the next block to retrieve if the data is longer than what can be stored inside a single block. By chaining blocks together, we can store arbitrary amounts of data without needing to change anything of the logic in the rest of LibSQL. As part of these changes, the "free list" is also removed from the heap awaiting an actual implementation: it was never used. Note that this bumps the database version from 3 to 4, and as such invalidates (deletes) any database opened with LibSQL that is not version 4.
2023-04-23LibSQL: Rename `Heap` constants to match our code styleJelle Raaijmakers
No functional changes. The constants are moved to constexpr variables inside `Heap`.
2023-04-23LibSQL: Remove unused `Tuple::is_compatible`Jelle Raaijmakers
2023-04-23LibSQL: Clean up code style and remove unused includesJelle Raaijmakers
No functional changes.
2023-04-23LibSQL: Remove and update `VERIFY`sJelle Raaijmakers
We are performing a lot of checks on pointers that are performed again immediately afterwards because of a dereference. This removes the redundant `VERIFY`s and simplifies a couple others.
2023-04-09Everywhere: Remove unused DeprecatedString includesBen Wiederhake
2023-03-28LibSQL: Block signals while forking SQLServer in LagomAndrew Kaster
When debugging in Xcode, the waitpid() for the initial forked process would always return EINTR or ECHILD. Work around this by blocking all signals until we're ready to wait for the initial child.
2023-03-21Everywhere: Use `LibFileSystem` where trivialCameron Youell
2023-03-15LibSyntax+Libraries: Replace TextStyle with Gfx::TextAttributesSam Atkins
Rather than creating a TextStyle struct, and then copying its fields over to a TextAttributes, let's just create a TextAttributes to start with. This also simplifies the syntax highlighting code by letting us define underlines along with the other text styling.
2023-03-13Everywhere: Remove unintentional partial stream reads and writesTim Schumacher
2023-03-13LibSQL: Always read and write entire heap blocksTim Schumacher
2023-03-13AK: Rename Stream::{read,write} to Stream::{read_some,write_some}Tim Schumacher
Similar to POSIX read, the basic read and write functions of AK::Stream do not have a lower limit of how much data they read or write (apart from "none at all"). Rename the functions to "read some [data]" and "write some [data]" (with "data" being omitted, since everything here is reading and writing data) to make them sufficiently distinct from the functions that ensure to use the entire buffer (which should be the go-to function for most usages). No functional changes, just a lot of new FIXMEs.
2023-03-10Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_caseAndreas Kling
Let's make it clear that these functions deal with ASCII case only.
2023-03-06Everywhere: Remove NonnullOwnPtr.h includesAndreas Kling
2023-03-06Everywhere: Remove NonnullRefPtr.h includesAndreas Kling
2023-03-06Everywhere: Stop using NonnullRefPtrVectorAndreas Kling
This class had slightly confusing semantics and the added weirdness doesn't seem worth it just so we can say "." instead of "->" when iterating over a vector of NNRPs. This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-02-21LibSQL: Fix minor const-correctness issuesAndreas Kling
2023-02-20LibSQL: Don't use fchmod for socket on any BSDNiklas Poslovski
2023-02-13LibCore: Remove `Stream.h`Tim Schumacher
2023-02-13LibCore: Move Stream-based file into the `Core` namespaceTim Schumacher
2023-02-13LibCore: Move Stream-based sockets into the `Core` namespaceTim Schumacher
2023-02-13LibCore: Rename `File` to `DeprecatedFile`Tim Schumacher
As usual, this removes many unused includes and moves used includes further down the chain.
2023-02-10Everywhere: Remove needless copies of Error / ErrorOr instancesTimothy Flynn
Either take the underlying objects with release_* methods or move() the instances around.
2023-02-08Everywhere: Use ReadonlySpan<T> instead of Span<T const>MacDue
2023-02-05LibSQL: Actually print an error message after failing to launch a serverKarol Kosek
We were shadowing the 'result' variable, which made an exec error message along with the search paths never being printed.
2023-02-03LibSQL+SQLServer: Send result column names over IPC to SQL clientsTimothy Flynn
2023-02-03LibSQL+Userland: Pass SQL IPC results to clients in a structureTimothy Flynn
SQLClient exists as a wrapper around SQL IPC to provide a bit friendlier interface for clients to deal with. Though right now, it mostly forwards values as-is from IPC to the clients. This makes it a bit verbose to add values to IPC responses, as we then have to add it to the callbacks used by all clients. It's also a bit confusing seeing a sea of "auto" as the parameter types for these callbacks. This patch moves these response values to named structures instead. This will allow adding values without needing to simultaneously update all clients. We can then separately handle the new values in interested clients only.
2023-02-03LibSQL: Store selected column names in the results for SELECT statementsTimothy Flynn
2023-02-02LibSQL+Ladybird: Accept a list of paths for spawning SQLServer in LagomAndrew Kaster
Use the new get_paths_for_helper_process method in Ladybird to query Qt for the runtime path of the current executable as well as the build directory paths.
2023-01-29AK: Move `Stream` and `SeekableStream` from `LibCore`Tim Schumacher
`Stream` will be qualified as `AK::Stream` until we remove the `Core::Stream` namespace. `IODevice` now reuses the `SeekMode` that is defined by `SeekableStream`, since defining its own would require us to qualify it with `AK::SeekMode` everywhere.
2023-01-29LibSQL: Use `kill` to exit forked SQLServer processes to avoid Qt issuesTimothy Flynn
In order to daemonize the SQLServer process for Ladybird, we double-fork and exit the first child process to ensure the grandchild process is in a detached state to become SQLServer. After commit c05fcd5, this happens after Ladybird's QApplication is created. QApplication seems to hook up some `exit` handling that makes the call to `exit(0)` here not actually exit the child process. Instead, using `kill` with SIGTERM will actually terminate the child process.
2023-01-27AK: Remove StringBuilder::build() in favor of to_deprecated_string()Linus Groh
Having an alias function that only wraps another one is silly, and keeping the more obvious name should flush out more uses of deprecated strings. No behavior change.
2023-01-26LibSQL: Don't interpret AK::Error codes as SQL error codesTimothy Flynn
This makes error invocations such as Error::from_string_literal become associated with a SQLErrorCode (typically 0, AmbiguousColumnName). The result, when displayed to the user, is quite confusing, e.g.: Column name 'Heap()::write_block(): Oversized block' is ambiguous Instead, just interpret these as internal errors, so the error message is displayed as-is.
2023-01-14LibSQL: Don't do fchmod on OpenBSDnipos
2023-01-14LibSQL: Don't do fchmod on FreeBSDnipos
2023-01-04LibIPC+Everywhere: Change IPC::encode's return type to ErrorOrTimothy Flynn
In doing so, this removes all uses of the Encoder's stream operator, except for where it is currently still used in the generated IPC code. So the stream operator currently discards any errors, which is the existing behavior. A subsequent commit will propagate the errors.
2023-01-02Everywhere: Remove unused includes of AK/Format.hBen Wiederhake
These instances were detected by searching for files that include AK/Format.h, but don't match the regex: \\b(CheckedFormatString|critical_dmesgln|dbgln|dbgln_if|dmesgln|FormatBu ilder|__FormatIfSupported|FormatIfSupported|FormatParser|FormatString|Fo rmattable|Formatter|__format_value|HasFormatter|max_format_arguments|out |outln|set_debug_enabled|StandardFormatter|TypeErasedFormatParams|TypeEr asedParameter|VariadicFormatParams|v_critical_dmesgln|vdbgln|vdmesgln|vf ormat|vout|warn|warnln|warnln_if)\\b (Without the linebreaks.) This regex is pessimistic, so there might be more files that don't actually use any formatting functions. Observe that this revealed that Userland/Libraries/LibC/signal.cpp is missing an include. In theory, one might use LibCPP to detect things like this automatically, but let's do this one step after another.
2023-01-02Everywhere: Move AK/Debug.h include to using files or removeBen Wiederhake
2023-01-01LibSQL: Add parsing and evaluation of BOOLEAN type literalsTimothy Flynn
This allows you to enter TRUE or FALSE in a SQL statement for BOOLEAN types. Note that this differs from SQLite, which requires entering 1 or 0 for BOOLEANs; having explicit keywords feels a bit more natural.