Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/sqlite-sync
Submodule sqlite-sync updated 60 files
+17 −0 .devcontainer/devcontainer.json
+3 −0 .github/workflows/main.yml
+0 −1 .gitignore
+37 −0 .vscode/launch.json
+574 −0 AGENTS.md
+175 −0 CLAUDE.md
+39 −0 CODEX.md
+30 −8 Makefile
+270 −0 POSTGRESQL.md
+352 −0 docker/Makefile.postgresql
+346 −0 docker/README.md
+46 −0 docker/postgresql/Dockerfile
+80 −0 docker/postgresql/Dockerfile.debug
+86 −0 docker/postgresql/Dockerfile.supabase
+22 −0 docker/postgresql/cloudsync.control
+8 −0 docker/postgresql/docker-compose.asan.yml
+58 −0 docker/postgresql/docker-compose.debug.yml
+51 −0 docker/postgresql/docker-compose.yml
+10 −0 docker/postgresql/init.sql
+104 −0 plans/PG_CLOUDSYNC_CHANGES_COL_VALUE_BYTEA.md
+583 −0 plans/POSTGRESQL_IMPLEMENTATION.md
+79 −0 plans/TODO.md
+1,328 −2,206 src/cloudsync.c
+105 −7 src/cloudsync.h
+99 −0 src/cloudsync_endian.h
+0 −55 src/cloudsync_private.h
+153 −0 src/database.h
+210 −879 src/dbutils.c
+17 −42 src/dbutils.h
+220 −132 src/network.c
+6 −0 src/network.h
+3 −2 src/network.m
+3 −2 src/network_private.h
+284 −144 src/pk.c
+12 −14 src/pk.h
+260 −0 src/postgresql/cloudsync--1.0.sql
+2,257 −0 src/postgresql/cloudsync_postgresql.c
+2,394 −0 src/postgresql/database_postgresql.c
+168 −0 src/postgresql/pgvalue.c
+43 −0 src/postgresql/pgvalue.h
+27 −0 src/postgresql/postgresql_log.h
+393 −0 src/postgresql/sql_postgresql.c
+69 −0 src/sql.h
+101 −33 src/sqlite/cloudsync_changes_sqlite.c
+21 −0 src/sqlite/cloudsync_changes_sqlite.h
+1,051 −0 src/sqlite/cloudsync_sqlite.c
+19 −0 src/sqlite/cloudsync_sqlite.h
+972 −0 src/sqlite/database_sqlite.c
+270 −0 src/sqlite/sql_sqlite.c
+53 −73 src/utils.c
+44 −47 src/utils.h
+0 −18 src/vtab.h
+99 −5 test/integration.c
+285 −0 test/postgresql/01_unittest.sql
+18 −0 test/postgresql/02_2db_roundtrip.sql
+290 −0 test/postgresql/03_3db_multiple_roundtrip.sql
+376 −0 test/postgresql/03_3db_multiple_roundtrip_debug.sql
+11 −0 test/postgresql/helper_psql_conn_setup.sql
+31 −0 test/postgresql/smoke_test.sql
+471 −241 test/unit.c
11 changes: 8 additions & 3 deletions wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
#include "modules/sqlite-sync/src/network.c"
#include "modules/sqlite-sync/src/dbutils.c"
#include "modules/sqlite-sync/src/cloudsync.c"
#include "modules/sqlite-sync/src/vtab.c"
#include "modules/sqlite-sync/src/pk.c"
#include "modules/sqlite-sync/src/lz4.c"
#include "modules/sqlite-sync/src/sqlite/cloudsync_changes_sqlite.c"
#include "modules/sqlite-sync/src/sqlite/cloudsync_sqlite.c"
#include "modules/sqlite-sync/src/sqlite/database_sqlite.c"
#include "modules/sqlite-sync/src/sqlite/sql_sqlite.c"

// sqlite-vector extension
#include "modules/sqlite-vector/src/sqlite-vector.c"
Expand All @@ -32,6 +35,8 @@

// MARK: - WASM -

#define AUTH_HEADER_MAXSIZE 4096

char *substr(const char *start, const char *end) {
size_t len = end - start;
char *out = (char *)malloc(len + 1);
Expand Down Expand Up @@ -78,7 +83,7 @@ NETWORK_RESULT network_receive_buffer (network_data *data, const char *endpoint,
}

// Authorization
char auth_header[256];
char auth_header[AUTH_HEADER_MAXSIZE];
if (authentication) {
snprintf(auth_header, sizeof(auth_header), "Bearer %s", authentication);
headers[h++] = "Authorization";
Expand Down Expand Up @@ -159,7 +164,7 @@ bool network_send_buffer(network_data *data, const char *endpoint, const char *a
int h = 0;
headers[h++] = "Accept";
headers[h++] = "text/plain";
char auth_header[256];
char auth_header[AUTH_HEADER_MAXSIZE];
if (authentication) {
snprintf(auth_header, sizeof(auth_header), "Bearer %s", authentication);
headers[h++] = "Authorization";
Expand Down