Dev/Database/Shell/File
From XOWA: the free, open-source, offline wiki application
Get the file [edit]
- launch sqlite3 shell. See Dev/Sqlite/Shell
- Turn on some options
-- enables column headers .header on -- enables column view .mode column .width 40 80
- Get a list of thumbs and their database
SELECT f.fil_name , t.thm_w , tb.dbb_url FROM fsdb_fil f JOIN fsdb_thm t ON f.fil_id = t.thm_owner_id JOIN fsdb_dbb tb ON t.thm_bin_db_id = tb.dbb_uid WHERE f.fil_name LIKE 'Earth%' LIMIT 10 ;
- The following output should be returned
dbb_url fil_name ---------------------------------------- -------------------------------------------------------------------------------- en.wikipedia.org-file-ns.000-db.001.xowa Earth_from_Apollo_11_after_translunar_injection.jpg en.wikipedia.org-file-ns.000-db.001.xowa Earth-moon.jpg en.wikipedia.org-file-ns.000-db.001.xowa Earth-moon.jpg en.wikipedia.org-file-ns.000-db.001.xowa Earth_Day_Flag.png en.wikipedia.org-file-ns.000-db.001.xowa Earth_precession.jpg en.wikipedia.org-file-ns.000-db.001.xowa Earth_Day_Flag.png en.wikipedia.org-file-ns.000-db.001.xowa Earthenware_architecture_models,_Eastern_Han_Dynasty,_5.JPG en.wikipedia.org-file-ns.000-db.001.xowa Earth_coordinates.PNG en.wikipedia.org-file-ns.000-db.001.xowa Earth_symbol.svg en.wikipedia.org-file-ns.000-db.001.xowa Earth-cutaway-schematic-english.svg
- Output some thumbs to the file-system
ATTACH 'en.wikipedia.org-file-ns.000-db.001.xowa' AS 'bin_db'; SELECT writefile(Cast(t.thm_size AS varchar(10)) || 'px-' || f.fil_name, tb.bin_data) AS file_data FROM fsdb_fil f JOIN fsdb_thm t ON f.fil_id = t.thm_owner_id JOIN bin_db.fsdb_bin tb ON t.thm_id = tb.bin_owner_id WHERE fil_name = 'Earth-moon.jpg'; DETACH 'bin_db';
- See a listing of the files
sqlite> .shell dir /b *px-* 497px-Earth-moon.jpg 644px-Earth-moon.jpg