summaryrefslogtreecommitdiffstats
path: root/www/shortnames.html
diff options
context:
space:
mode:
Diffstat (limited to 'www/shortnames.html')
-rw-r--r--www/shortnames.html241
1 files changed, 241 insertions, 0 deletions
diff --git a/www/shortnames.html b/www/shortnames.html
new file mode 100644
index 0000000..2fd104f
--- /dev/null
+++ b/www/shortnames.html
@@ -0,0 +1,241 @@
+<!DOCTYPE html>
+<html><head>
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<link href="sqlite.css" rel="stylesheet">
+<title>8+3 Filenames</title>
+<!-- path= -->
+</head>
+<body>
+<div class=nosearch>
+<a href="index.html">
+<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
+</a>
+<div><!-- IE hack to prevent disappearing logo --></div>
+<div class="tagline desktoponly">
+Small. Fast. Reliable.<br>Choose any three.
+</div>
+<div class="menu mainmenu">
+<ul>
+<li><a href="index.html">Home</a>
+<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
+<li class='wideonly'><a href='about.html'>About</a>
+<li class='desktoponly'><a href="docs.html">Documentation</a>
+<li class='desktoponly'><a href="download.html">Download</a>
+<li class='wideonly'><a href='copyright.html'>License</a>
+<li class='desktoponly'><a href="support.html">Support</a>
+<li class='desktoponly'><a href="prosupport.html">Purchase</a>
+<li class='search' id='search_menubutton'>
+<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
+</ul>
+</div>
+<div class="menu submenu" id="submenu">
+<ul>
+<li><a href='about.html'>About</a>
+<li><a href='docs.html'>Documentation</a>
+<li><a href='download.html'>Download</a>
+<li><a href='support.html'>Support</a>
+<li><a href='prosupport.html'>Purchase</a>
+</ul>
+</div>
+<div class="searchmenu" id="searchmenu">
+<form method="GET" action="search">
+<select name="s" id="searchtype">
+<option value="d">Search Documentation</option>
+<option value="c">Search Changelog</option>
+</select>
+<input type="text" name="q" id="searchbox" value="">
+<input type="submit" value="Go">
+</form>
+</div>
+</div>
+<script>
+function toggle_div(nm) {
+var w = document.getElementById(nm);
+if( w.style.display=="block" ){
+w.style.display = "none";
+}else{
+w.style.display = "block";
+}
+}
+function toggle_search() {
+var w = document.getElementById("searchmenu");
+if( w.style.display=="block" ){
+w.style.display = "none";
+} else {
+w.style.display = "block";
+setTimeout(function(){
+document.getElementById("searchbox").focus()
+}, 30);
+}
+}
+function div_off(nm){document.getElementById(nm).style.display="none";}
+window.onbeforeunload = function(e){div_off("submenu");}
+/* Disable the Search feature if we are not operating from CGI, since */
+/* Search is accomplished using CGI and will not work without it. */
+if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
+document.getElementById("search_menubutton").style.display = "none";
+}
+/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
+function hideorshow(btn,obj){
+var x = document.getElementById(obj);
+var b = document.getElementById(btn);
+if( x.style.display!='none' ){
+x.style.display = 'none';
+b.innerHTML='show';
+}else{
+x.style.display = '';
+b.innerHTML='hide';
+}
+return false;
+}
+var antiRobot = 0;
+function antiRobotGo(){
+if( antiRobot!=3 ) return;
+antiRobot = 7;
+var j = document.getElementById("mtimelink");
+if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
+}
+function antiRobotDefense(){
+document.body.onmousedown=function(){
+antiRobot |= 2;
+antiRobotGo();
+document.body.onmousedown=null;
+}
+document.body.onmousemove=function(){
+antiRobot |= 2;
+antiRobotGo();
+document.body.onmousemove=null;
+}
+setTimeout(function(){
+antiRobot |= 1;
+antiRobotGo();
+}, 100)
+antiRobotGo();
+}
+antiRobotDefense();
+</script>
+
+
+
+<h1 align="center">SQLite And 8+3 Filenames</h1>
+
+<p>
+The default configuration of SQLite assumes the underlying filesystem
+supports long filenames.
+</p>
+
+<p>
+SQLite does not impose any naming requirements on database files.
+SQLite will happily work with a database file that has any filename extension
+or with no extension at all.
+When auxiliary files are needed for a <a href="lockingv3.html#rollback">rollback journal</a> or
+a <a href="wal.html">write-ahead log</a> or for one of the other kinds of
+<a href="tempfiles.html">temporary disk files</a>, then the name for the auxiliary file is normally
+constructed by appending a suffix onto the end of the database file name.
+For example, if the original database is call "<tt>app.db</tt>" then
+the <a href="lockingv3.html#rollback">rollback journal</a> will be called "<tt>app.db-journal</tt>"
+and the <a href="wal.html">write-ahead log</a> will be called "<tt>app.db-wal</tt>".
+This approach to auxiliary file naming works great on systems that
+support long filenames. But on systems that impose 8+3 filename
+constraints, the auxiliary files do not fit the 8+3 format even though
+the original database file does.
+</p>
+
+
+<h2>Changing Filesystems</h2>
+
+<p>
+The recommended fix for this problem is to select a different
+filesystem. These days, there is a huge selection of high-performance,
+reliable, patent-free filesystems that support long filenames.
+Where possible, it is recommended that embedded devices use one
+of these other filesystems. This will avoid compatibility issues
+and the danger of
+<a href="shortnames.html#db83corrupt">database corruption caused by inconsistent use of 8+3 filenames</a>.
+</p>
+
+<h2>Adjusting SQLite To Use 8+3 Filenames</h2>
+
+<p>
+Some devices are compelled to use an older filesystem with 8+3
+filename restrictions for backwards compatibility, or due
+to other non-technical factors. In such situations, SQLite can be
+coerced into using auxiliary files that fit the 8+3 pattern as follows:
+</p>
+
+<ol>
+<li><p>Compile the SQLite library with the either the compile-time
+ options <a href="compile.html#enable_8_3_names">SQLITE_ENABLE_8_3_NAMES=1</a> or
+ <a href="compile.html#enable_8_3_names">SQLITE_ENABLE_8_3_NAMES=2</a>.
+ Support for 8+3 filenames is not included in SQLite by default
+ because it does introduce some overhead. The overhead is tiny,
+ but even so, we do not want to burden the billions of SQLite
+ applications that do not need 8+3 filename support.</p>
+
+<li><p>If the <a href="compile.html#enable_8_3_names">SQLITE_ENABLE_8_3_NAMES=1</a> option
+ is used, then SQLite is capable of using 8+3 filenames but that
+ capabilities is disabled and must be enabled separately for each
+ database connection by using
+ using <a href="uri.html">URI filenames</a> when <a href="c3ref/open.html">opening</a> or
+ <a href="lang_attach.html">ATTACH-ing</a> the database files and include the
+ "<tt>8_3_names=1</tt>" query parameter in the URI. If SQLite
+ is compiled with
+ <a href="compile.html#enable_8_3_names">SQLITE_ENABLE_8_3_NAMES=2</a> then
+ 8+3 filenames are enabled by default and this step can be
+ skipped.</p>
+
+<li><p>Make sure that database filenames follow the 8+3 filename
+ format and that they do not have an empty name or extension.
+ In other words, the database filename must contain between
+ 1 and 8 characters in the base name and between 1 and 3 characters
+ in the extension. Blank extensions are not allowed.</p>
+</ol>
+
+<p>
+When the steps above are used, SQLite will shorten filename extensions
+by only using the last 3 characters of
+the extension. Thus, for example, a file that would normally be called
+"<tt>app.db-journal</tt>" is shortened to just "<tt>app.nal</tt>".
+Similarly, "<tt>app.db-wal</tt>" will become "<tt>app.wal</tt>" and
+"<tt>app.db-shm</tt>" becomes "<tt>app.shm</tt>".
+</p>
+
+<p>
+Note that it is very important that the database filename have some kind
+of extension. If there is no extension, then SQLite creates auxiliary
+filenames by appending to the base name of the file. Thus, a database
+named "<tt>db01</tt>" would have a <a href="lockingv3.html#rollback">rollback journal</a> file named
+"<tt>db01-journal</tt>". And as this filename has no extension to shorten
+to 3 characters, it will be used as-is, and will violate 8+3 naming rules.
+</p>
+
+<a name="db83corrupt"></a>
+
+<h2>Database Corruption Warning</h2>
+
+<p>
+If a database file is accessed using 8+3 naming rather than the default
+long filename, then it must be consistently accessed
+using 8+3 naming by every database
+connection every time it is opened, or else there is a risk of database
+corruption.
+The auxiliary <a href="lockingv3.html#rollback">rollback journal</a> and <a href="wal.html">write-ahead log</a> files are essential
+to SQLite for being about to recover from a crash. If an application is
+using 8+3 names and crashes, then the information needed to safely recover
+from the crash is stored in files with the "<tt>.nal</tt>" or
+"<tt>.wal</tt>" extension. If the next application to open the database
+does not specify the "<tt>8_3_names=1</tt>" URI parameter, then SQLite
+will use the long filenames to try to locate the rollback journal or
+write-ahead log files. It will not find them, since they were saved using
+8+3 names by the application that crashed, and hence the database will not
+be properly recovered and will likely go corrupt.
+</p>
+
+<p>
+Using a database file with 8+3 filenames in some cases while in
+other cases using long filenames is equivalent to
+<a href="howtocorrupt.html#delhotjrnl">deleting a hot journal</a>.
+</p>
+<p align="center"><small><i>This page last modified on <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink" data-href="https://sqlite.org/docsrc/finfo/pages/shortnames.in?m=7fc7e0cffc">2022-01-08 05:02:57</a> UTC </small></i></p>
+