Skip to content

Commit

Permalink
feat: identify eof bug
Browse files Browse the repository at this point in the history
  • Loading branch information
speed2exe committed Oct 26, 2023
1 parent d7e0f1d commit d78d0cf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion integration_tests/client.zig
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ test "ping" {
try c.ping();
}

test "query" {
test "query database create and drop" {
var c = Client.init(test_config, std.testing.allocator);
defer c.deinit();

try c.query("CREATE DATABASE testdb");
try c.query("DROP DATABASE testdb");
}

// test "query select 1" {
// var c = Client.init(test_config, std.testing.allocator);
// defer c.deinit();
//
// try c.query("show databases");
// }
5 changes: 1 addition & 4 deletions src/config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ pub const Config = struct {
pub fn capability_flags(config: *const Config) u32 {
// zig fmt: off
var flags: u32 = constants.CLIENT_PROTOCOL_41
| constants.CLIENT_LONG_PASSWORD
| constants.CLIENT_LOCAL_FILES
| constants.CLIENT_PLUGIN_AUTH
| constants.CLIENT_MULTI_RESULTS
| constants.CLIENT_CONNECT_ATTRS
// TODO: Support more
;
// zig fmt: on
if (config.client_found_rows) {
Expand Down
Empty file added src/reade
Empty file.
3 changes: 3 additions & 0 deletions src/stream_buffered.zig
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ pub const Reader = struct {

inline fn fill(s: *Reader) !void {
s.len = try s.stream.read(&s.buf);
if (s.len == 0) {
return error.UnexpectedEndOfStream;
}
s.pos = 0;
}

Expand Down

0 comments on commit d78d0cf

Please sign in to comment.