1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2024-10-27 20:34:16 +00:00
gnosygnu_xowa/wiki/home/page/Dev/Database/Shell/File.html

176 lines
7.2 KiB
HTML
Raw Normal View History

2016-04-12 23:06:56 +00:00
<!DOCTYPE html>
<html dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Dev/Database/Shell/File - XOWA</title>
<link rel="shortcut icon" href="/xowa/wiki/home/page/xowa_logo.png" />
<link rel="stylesheet" href="/xowa/wiki/home/page/xowa_common.css" type="text/css">
</head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject skin-vector action-submit vector-animateLayout" spellcheck="false">
<div id="mw-page-base" class="noprint"></div>
<div id="mw-head-base" class="noprint"></div>
<div id="content" class="mw-body">
<h1 id="firstHeading" class="firstHeading"><span>Dev/Database/Shell/File</span></h1>
<div id="bodyContent" class="mw-body-content">
<div id="siteSub">From XOWA: the free, open-source, offline wiki application</div>
<div id="contentSub"></div>
<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr">
<p>
<a href="/xowa/wiki/home/page/Template:Css/Sqlite.html" id="xolnki_2" title="Template:Css/Sqlite">Template:Css/Sqlite</a>
</p>
<h3>
<span class="mw-headline" id="Get_the_file">Get the file</span>
</h3>
<ul>
<li>
launch sqlite3 shell. See <a href="/xowa/wiki/home/page/Dev/Sqlite/Shell.html" id="xolnki_3" title="Dev/Sqlite/Shell">Dev/Sqlite/Shell</a>
</li>
<li>
Turn on some options
</li>
</ul>
<pre class='sqlite-sql'>
-- enables column headers
.header on
-- enables column view
.mode column
.width 40 80
</pre>
<ul>
<li>
Get a list of thumbs and their database
</li>
</ul>
<pre class='sqlite-sql'>
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
;
</pre>
<dl>
<dd>
The following output should be returned
</dd>
</dl>
<pre>
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
</pre>
<ul>
<li>
Output some thumbs to the file-system
</li>
</ul>
<pre>
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';
</pre>
<ul>
<li>
See a listing of the files
</li>
</ul>
<pre>
sqlite&gt; .shell dir /b *px-*
497px-Earth-moon.jpg
644px-Earth-moon.jpg
</pre>
</div>
</div>
</div>
<div id="mw-head" class="noprint">
<div id="left-navigation">
<div id="p-namespaces" class="vectorTabs">
<h3>Namespaces</h3>
<ul>
<li id="ca-nstab-main" class="selected"><span><a id="ca-nstab-main-href" href="index.html">Page</a></span></li>
</ul>
</div>
</div>
</div>
<div id='mw-panel' class='noprint'>
<div id='p-logo'>
<a style="background-image: url(/xowa/wiki/home/page/xowa_logo.png);" href="https://gnosygnu.github.io/xowa/" title="Visit the main page"></a>
</div>
<div class="portal" id='xowa-portal-home'>
<h3>XOWA</h3>
<div class="body">
<ul>
<li><a href="https://gnosygnu.github.io/xowa/" title='Visit the main page'>Main page</a></li>
<li><a href="https://gnosygnu.github.io/xowa/blog.html" title='Follow XOWA''s development process'>Blog</a></li>
<li><a href="https://gnosygnu.github.io/xowa/screenshots.html" title='See screenshots of XOWA'>Screenshots</a></li>
<li><a href="https://gnosygnu.github.io/xowa/download.html" title='Download the XOWA application'>Download XOWA</a></li>
<li><a href="/xowa/wiki/home/page/Dashboard/Image_databases" title='Download offline wikis and image databases'>Download wikis</a></li>
<li><a href="https://gnosygnu.github.io/xowa/reviews.html" title='Read what others have written about XOWA'>Media</a></li>
<li><a href="/xowa/wiki/home/page/Help/About.html" title='Get more information about XOWA'>About</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-help'>
<h3>Help</h3>
<div class="body">
<ul>
<li><a href="/xowa/wiki/home/page/App/Setup/System_requirements.html" title='Get XOWA&apos;s system requirements'>Requirements</a></li>
<li><a href="/xowa/wiki/home/page/App/Setup/Installation.html" title='Get instructions for installing XOWA'>Installation</a></li>
<li><a href="/xowa/wiki/home/page/App/Import/Simple_Wikipedia.html" title='Learn how to set up Simple Wikipedia'>Set up Simple Wikipedia</a></li>
<li><a href="/xowa/wiki/home/page/App/Import/English_Wikipedia.html" title='Learn how to set up English Wikipedia'>Set up English Wikipedia</a></li>
<li><a href="/xowa/wiki/home/page/App/Import/Other_wikis.html" title='Learn how to set up Other Wikipedias'>Set up Other Wikipedias</a></li>
<li><a href="/xowa/wiki/home/page/Help/Feedback.html" title='Questions? Comments? Leave feedback for XOWA'>Feedback</a></li>
<li><a href="/xowa/wiki/home/page/Help/Contents.html" title='View a list of help topics'>Contents</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-links'>
<h3>Links</h3>
<div class="body">
<ul>
<li><a href="http://dumps.wikimedia.org/backup-index.html" title="Get wiki datababase dumps directly from Wikimedia">Wikimedia dumps</a></li>
<li><a href="https://archive.org/search.php?query=xowa" title="Search archive.org for XOWA files">XOWA @ archive.org</a></li>
<li><a href="http://en.wikipedia.org" title="Visit Wikipedia (and compare to XOWA!)">English Wikipedia</a></li>
</ul>
</div>
</div>
<div class="portal" id='xowa-portal-donate'>
<h3>Donate</h3>
<div class="body">
<ul>
<li><a href="https://archive.org/donate/index.php" title="Support archive.org!">archive.org</a></li><!-- listed first due to recent fire damages: http://blog.archive.org/2013/11/06/scanning-center-fire-please-help-rebuild/ -->
<li><a href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector" title="Support Wikipedia!">Wikipedia</a></li>
<!-- <li><a href="" title="Support XOWA! (but only after you've supported archive.org and Wikipedia)">XOWA</a></li> -->
</ul>
</div>
</div>
</div>
</body>
</html>