XVRML25CYFXM5IXRG4L45Y6DWLAFLXPH5PWGO424KWAE3BQHGUGAC
if (args.flag("--migrate")) {
if (args.flag("--yolo")) try db.exec("PRAGMA synchronous=0;", .{}, .{});
try db.exec("BEGIN IMMEDIATE;", .{}, .{});
errdefer db.exec("ROLLBACK;", .{}, .{}) catch std.debug.panic("SQLite database errored trying to roll back. Have fun!", .{});
var stmt = try db.prepare("SELECT ROWID FROM image;");
defer stmt.deinit();
var iter = try stmt.iterator(u64, .{});
while (try iter.next(.{})) |id| {
try db.exec(
\\INSERT INTO blob (data, hash)
\\ SELECT image, hash_full
\\ FROM image WHERE ROWID = ?;
, .{}, .{id});
try db.exec(
\\UPDATE image
\\ SET image_id = last_insert_rowid()
\\ WHERE ROWID = ?
, .{}, .{id});
try db.exec(
\\INSERT INTO blob (data, hash)
\\ SELECT thumb, hash_thumb
\\ FROM image WHERE ROWID = ?;
, .{}, .{id});
try db.exec(
\\UPDATE image
\\ SET thumb_id = last_insert_rowid()
\\ WHERE ROWID = ?
, .{}, .{id});
}
db.exec("COMMIT;", .{}, .{}) catch std.debug.panic("SQLite database errored trying to commit. Not *terrible*, I guess.", .{});
return;
}
try req.reset(url);
try req.do(.GET, headers, null);
const reader = req.reader();
try reader.readAllArrayList(&buf, 500 * 1024);
const val = try json.parse(alloc, buf.items);
fuckme.clearRetainingCapacity();
try easyFetch(handle, &urlbuf, &fuckme);
const val = try json.parse(alloc, fuckme.items);
};
try db.exec("BEGIN IMMEDIATE;", .{}, .{});
errdefer db.exec("ROLLBACK;", .{}, .{}) catch {};
db.exec(
"UPDATE OR ROLLBACK image SET image = ? WHERE id = ?",
.{},
.{
.image = resp.items,
.id = id,
},
) catch {
sqliteErrorReport("Couldn't add image to DB.", db);
return error.GO_ON;
log.info("Failed to download thumbnail image for ID {d}", .{id});
return error.GO_ON;
};
try db.exec("BEGIN IMMEDIATE;", .{}, .{});
errdefer db.exec("ROLLBACK;", .{}, .{}) catch {};
db.exec(
"UPDATE OR ROLLBACK image SET thumb = ? WHERE id = ?",
.{},
.{
.thumb = resp.items,
.id = id,
},
) catch {
sqliteErrorReport("Couldn't add thumb to DB", db);
return error.GO_ON;
log.info("Failed to download fullsize image for ID {d}", .{id});
return error.FATAL;
- -DSQLITE_ENABLE_DQS=0
- -DSQLITE_THREADSAFE=0
- -DSQLITE_DEFAULT_MEMSTATUS=0
- -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1
- -DSQLITE_LIKE_DOESNT_MATCH_BLOBS
- -DSQLITE_MAX_EXPR_DEPTH=0
- -DSQLITE_OMIT_DEPRECATED
- -DSQLITE_OMIT_SHARED_CACHE
- -DSQLITE_DEFAULT_FOREIGN_KEYS
- -DHAVE_FDATASYNC
- -DHAVE_ISNAN
- -DSQLITE_USE_URI
- -DSQLITE_ALLOW_URI_AUTHORITY
- -DSQLITE_ENABLE_BYTECODE_VTAB
- -DSQLITE_ENABLE_COLUMN_METADATA
- -DSQLITE_ENABLE_DBPAGE_VTAB
- -DSQLITE_ENABLE_DBSTAT_VTAB
- -DSQLITE_ENABLE_EXPLAIN_COMMENTS
- -DSQLITE_ENABLE_FTS5
- -DSQLITE_ENABLE_MATH_FUNCTIONS
- -DSQLITE_ENABLE_BATCH_ATOMIC_WRITE=1
c_source_files:
- ../../../../../../sqlite-amalgamation-3360000/sqlite3.c
git https://github.com/Hejsil/zig-clap commit-ed90e560d9b1144a27562ef62ff7686eb3af029a
git https://github.com/vrischmann/zig-sqlite commit-1adb900dcc816a419a4b67ccae0555ffe33f72c4
git https://github.com/Hejsil/zig-clap commit-c5fb22823a9a4a699acaefc1e9febfee0b8e506c
git https://github.com/vrischmann/zig-sqlite commit-4954c419d379ffbb637904b41d25ef910c6bb02b
git https://github.com/truemedian/zfetch commit-8bbc7b34cd417794841e1432585334bc969dfe83
git https://github.com/truemedian/hzzp commit-2d30bddae3bf1eaecde5144490307604efe76f2a
git https://github.com/truemedian/zfetch commit-6ba2ba136ec7cfc887811039cd4a7d8a43ba725b
git https://github.com/truemedian/hzzp commit-492107d44caa2676c7b5aa4e934e1e937232d652