This file is indexed.

/usr/share/qt5/doc/qtdoc/topics-data-storage.html is in qt5-doc-html 5.3.2-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- datastorage.qdoc -->
  <title>Data Storage | QtDoc 5.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
    <div class="main">
    <div class="main-rounded">
        <div class="navigationbar">
        <ul>
<li><a href="index.html">Qt 5.3</a></li>
<li>Data Storage</li>
<li id="buildversion">
Qt 5.3.2 Reference Documentation</li>
    </ul>
    </div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#saving-and-loading-data">Saving and Loading Data</a></li>
<li class="level1"><a href="#sql-support-in-qt">SQL support in Qt</a></li>
<li class="level1"><a href="#xml-support-in-qt">XML Support in Qt</a></li>
<li class="level1"><a href="#json-in-qt">JSON in Qt</a></li>
<li class="level1"><a href="#local-storage">Local Storage</a></li>
<li class="level1"><a href="#qsettings">QSettings</a></li>
<li class="level1"><a href="#resources">Resources</a></li>
<li class="level1"><a href="#file-archiving">File Archiving</a></li>
<li class="level1"><a href="#enginio-data-storage">Enginio Data Storage</a></li>
</ul>
</div>
<h1 class="title">Data Storage</h1>
<span class="subtitle"></span>
<!-- $$$topics-data-storage.html-description -->
<div class="descr"> <a name="details"></a>
<a name="saving-and-loading-data"></a>
<h2>Saving and Loading Data</h2>
<p>The <a href="../qtcore/qiodevice.html">QIODevice</a> class is the base class for all file and data storage devices in <a href="../qtcore/qtcore-index.html">Qt Core</a>. All classes that are used for reading and writing data inherit from it.</p>
<p>Examples of devices are <a href="../qtcore/qfile.html">QFile</a>, <a href="../qtcore/qbuffer.html">QBuffer</a>, <a href="../qtnetwork/qtcpsocket.html">QTcpSocket</a>, and <a href="../qtcore/qprocess.html">QProcess</a>. <a href="../qtcore/qfile.html">QFile</a> is used for reading and writing text, binary files, and resources. The <a href="../qtcore/qbuffer.html">QBuffer</a> class provides a <a href="../qtcore/qiodevice.html">QIODevice</a> interface for a <a href="../qtcore/qbytearray.html">QByteArray</a>. <a href="../qtnetwork/qtcpsocket.html">QTcpSocket</a> enables the developer to establish a TCP connection and transfer streams of data. <a href="../qtcore/qprocess.html">QProcess</a> is used to start external programs, and to read from and write to that process.</p>
<ul>
<li><a href="../qtcore/io.html">Input/Output and Networking</a> (list of I/O related classes)</li>
<li><a href="../qtcore/io-functions.html">File and Datastream Functions</a></li>
<li><a href="../qtcore/datastreamformat.html">Serializing Qt Data Types</a></li>
</ul>
<a name="sql-support-in-qt"></a>
<h2>SQL support in Qt</h2>
<p>The <a href="../qtsql/qtsql-index.html">Qt SQL</a> module uses driver plugins to communicate with several database APIs. Qt has drivers for SQLite, MySQL, DB2, Borland InterBase, Oracle, ODBC, and PostgreSQL. It is also possible to develop your own driver if Qt does not provide the driver needed.</p>
<p>Qt's SQL classes can be divided in 3 layers:</p>
<table class="generic">
 <thead><tr class="qt-style"><th >Layer</th><th >Purpose</th><th >Example class</th></tr></thead>
<tr valign="top" class="odd"><td ><ul>
<li>Driver layer</li>
<li>SQL API layer</li>
<li>User Interface layer</li>
</ul>
</td><td ><ul>
<li>Low-level communication between database and the SQL API layer</li>
<li>Provide access to databases</li>
<li>Link data from a database to data-aware widgets</li>
</ul>
</td><td ><ul>
<li><a href="../qtsql/qsqldriver.html">QSqlDriver</a>, <a href="../qtsql/qsqldrivercreator.html">QSqlDriverCreator</a></li>
<li><a href="../qtsql/qsqldatabase.html">QSqlDatabase</a>, <a href="../qtsql/qsqlquery.html">QSqlQuery</a></li>
<li><a href="../qtsql/qsqlquerymodel.html">QSqlQueryModel</a> (readonly), <a href="../qtsql/qsqltablemodel.html">QSqlTableModel</a> (read/write), <a href="../qtsql/qsqlrelationaltablemodel.html">QSqlRelationalTableModel</a> (read/write with foreign-key support)</li>
</ul>
</td></tr>
</table>
<p>With the MySQL driver, it is possible to connect to a MySQL server. In order to build the QMYSQL Plugin for Unix or Mac OS X, you need the MySQL header files as well as the shared library, libmysqlclient.so. To compile the plugin for Windows, install MySQL.</p>
<p>If you use the embedded MySQL Server, you do not need a MySQL server in order to use that database system. In order to do so, you need to link the Qt plugin to libmysqld instead of libmysqlclient.</p>
<p>The Qt SQLite plugin is very suitable for local storage. SQLite is a relational database management system contained in a small (~350 KiB) C library. In contrast to other database management systems, SQLite is not a separate process that is accessed from the client application, but an integral part of it. SQLite operates on a single file, which must be set as the database name when opening a connection. If the file does not exist, SQLite will try to create it.</p>
<p>SQLite has some restrictions regarding multiple users and multiple transactions. If you are reading or writing on a file from different transactions, your application might freeze until one transaction commits or rolls back.</p>
<p>Once the driver part is set up, the data is accessible using the classes, <a href="../qtsql/qsqlquerymodel.html">QSqlQueryModel</a>, <a href="../qtsql/qsqltablemodel.html">QSqlTableModel</a>, and <a href="../qtsql/qsqlrelationaltablemodel.html">QSqlRelationalTableModel</a>. <a href="../qtsql/qsqltablemodel.html">QSqlTableModel</a> and <a href="../qtsql/qsqlrelationaltablemodel.html">QSqlRelationalTableModel</a> provide editable models that can used with Qt's item views. <a href="../qtsql/qsqltablemodel.html">QSqlTableModel</a> has read/write access to a single table, whereas <a href="../qtsql/qsqlrelationaltablemodel.html">QSqlRelationalTableModel</a> has read/write access to the main table (not to the table with the foreign key).</p>
<p>The following pages contain information about incorporating SQL into applications:</p>
<ul>
<li><a href="../qtsql/sql-programming.html">SQL Programming</a><ul>
<li><a href="../qtsql/database.html">Database Classes</a></li>
<li><a href="../qtsql/sql-sqlstatements.html">Executing SQL Statements</a></li>
<li><a href="../qtsql/sql-model.html">Using the SQL Model Classes</a></li>
<li><a href="../qtsql/sql-presenting.html">Presenting Data in a Table View</a></li>
<li><a href="../qtsql/sql-forms.html">Creating Data-Aware Forms</a></li>
</ul>
</li>
</ul>
<a name="xml-support-in-qt"></a>
<h2>XML Support in Qt</h2>
<p>Qt provides APIs to read and parse XML streams, and also to write to these streams. The following key classes facilitate these actions by providing the necessary infrastructure:</p>
<ul>
<li><a href="../qtcore/qxmlstreamreader.html">QXmlStreamReader</a> class provides a parser to read XML. It is a well-formed XML 1.0 parser that does not include external parsed entities.<ul>
<li>It understands and resolves XML namespaces. For example, in case of a StartElement, namespaceUri() returns the namespace the element is in, and name() returns the element's local name. The combination of namespaceUri() and name() uniquely identifies an element.</li>
<li>It is not CPU-intensive, as it doesn't store the entire XML document tree in memory. It only stores the current token at the time it is reported.</li>
</ul>
</li>
<li>The <a href="../qtcore/qxmlstreamwriter.html">QXmlStreamWriter</a> class provides an XML writer with a simple streaming API. It is the counterpart to <a href="../qtcore/qxmlstreamreader.html">QXmlStreamReader</a> for writing XML, and it operates on a <a href="../qtcore/qiodevice.html">QIODevice</a> specified with setDevice().<ul>
<li>It is a simple API that provides a dedicated function for every XML token or event you want to write.</li>
<li>It takes care of prefixing namespaces based on the namespaceUri specified while writing elements or attributes. If you have to use certain standardized prefixes, you can force the writer to use them by declaring the namespaces manually with either writeNamespace() or writeDefaultNamespace().</li>
<li>It can automatically format the generated XML data by adding line-breaks and indentation, making it readable. This feature can be turned on with the auto-formatting property.</li>
<li>It encodes XML in UTF-8 by default. Different encodings can be enforced using setCodec().</li>
</ul>
</li>
</ul>
<p>Besides reading and writing to XML streams, Qt also provides APIs for the following additional use cases:</p>
<ul>
<li>Querying an XML data source using <a href="../qtxmlpatterns/xmlprocessing.html">XQuery</a> and XPath</li>
<li>XML transformation using XSLT</li>
<li>XML schema validation</li>
</ul>
<p>The following topics provide more insight into Qt XML support:</p>
<ul>
<li><a href="../qtxml/xml-namespaces.html">An Introduction to Namespaces</a></li>
<li><a href="../qtxml/xml-streaming.html">XML Streaming</a></li>
<li><a href="../qtxmlpatterns/xquery-introduction.html">A Short Path to XQuery</a></li>
<li><a href="../qtquick/qml-qtquick-xmllistmodel-xmllistmodel.html">XmlListModel</a></li>
<li><a href="../qtxmlpatterns/qtxmlpatterns-index.html">Qt XML Patterns</a></li>
</ul>
<a name="json-in-qt"></a>
<h2>JSON in Qt</h2>
<p>JSON is a text-based open standard for data interchange that is easy to read and parse. It is used for representing simple data structures and associative arrays, called objects. It is related to JavaScript, but is a language-independent notation form.</p>
<p>An object can take 2 forms:</p>
<table class="generic">
 <thead><tr class="qt-style"><ul>
<li>Collection of name/value pairs</li>
<li>Ordered list of values</li>
</ul>
</tr></thead>
<tr valign="top" class="odd"><td ><ul>
<li>{ &quot;last_name&quot;: &quot;Routledge&quot;, &quot;first_name&quot;: &quot;Ronald&quot;, &quot;birth_date&quot;: 1960 }</li>
<li>&quot;colours&quot;: [&quot;green&quot;, &quot;blue&quot;, &quot;yellow&quot;]</li>
</ul>
</td><td ></td></tr>
</table>
<ul>
<li><a href="../qtcore/json.html">JSON Support in Qt</a></li>
<li><a href="../qtcore/qtcore-savegame-example.html">JSON Save Game Example</a></li>
</ul>
<a name="local-storage"></a>
<h2>Local Storage</h2>
<p>The Local Storage API provides the ability to access local offline storage in an SQL database from QML and JavaScript.</p>
<p>These databases are user-specific and QML-specific, but accessible to all QML applications. They are stored in the Databases subdirectory of QDeclarativeEngine::offlineStoragePath() as SQLite databases (<a href="../qtsql/sql-driver.html">SQL Database Drivers</a>).</p>
<p>The API conforms to the Synchronous API of the HTML5 Web Database API, W3C Working Draft 29 October 2009 (<a href="http://www.w3.org/TR/2009/WD-webdatabase-20091029/">HTML5 Web Database API</a>).</p>
<p>See <a href="../qtquick/qtquick-localstorage-example.html">Qt Quick Examples - Local Storage</a> for a basic demonstration of using the Local Storage API.</p>
<ul>
<li><a href="../qtquick/qtquick-localstorage-qmlmodule.html">Qt Quick Local Storage QML Types</a></li>
</ul>
<a name="qsettings"></a>
<h2>QSettings</h2>
<p>The <a href="../qtcore/qsettings.html">QSettings</a> class provides persistent storage of application settings. An application usually remembers its settings from the previous session.</p>
<p>Settings are stored differently on different platforms. For example, on Windows they are stored in the registry, whereas, on MAC OS X they are stored in XML files.</p>
<p><a href="../qtcore/qsettings.html">QSettings</a> enable you to save and restore application settings in a portable manner. Constructing and destroying a <a href="../qtcore/qsettings.html">QSettings</a> object is lightweight and fast. While creating an object of <a href="../qtcore/qsettings.html">QSettings</a>, it is a good practice to specify not only the name of the application, but also the name of your organization. For example:</p>
<pre class="cpp"><span class="type"><a href="../qtcore/qsettings.html">QSettings</a></span> settings(<span class="string">&quot;MyCompany&quot;</span><span class="operator">,</span> <span class="string">&quot;Accountancy&quot;</span>);</pre>
<a name="resources"></a>
<h2>Resources</h2>
<p>The Qt Resource System is a platform-independent mechanism for storing binary files in the application's executable. This is handy if your application frequently needs a certain file, or set of files. It also protects against loss of that particular file .</p>
<p>Resource data can either be compiled into the binary and accessed immediately in the application code, or a binary resource can be created dynamically and registered with the resource system by the application.</p>
<p>By default, resources are accessible from the application code by the same file name as they are stored in the source tree, with a <tt>:/</tt> prefix, or by a URL with a qrc scheme.</p>
<ul>
<li><a href="../qtcore/resources.html">The Qt Resource System</a></li>
</ul>
<a name="file-archiving"></a>
<h2>File Archiving</h2>
<p>An archive file is a collection of files or directories which are generally compressed in order to reduce the space they would otherwise consume on a drive. Examples of archive files are ZIP, TAR, RAR and 7z.</p>
<p>Qt has support for archives produced by zlib (see <a href="http://qt-project.org/faq/answer/how_to_compress_data_with_qt">qCompress() and qUncompress()</a>).</p>
<a name="enginio-data-storage"></a>
<h2>Enginio Data Storage</h2>
<p>Enginio is a storage service for applications. New in Qt 5.3, <a href="../qtenginiooverview/enginio-index.html">Enginio</a> combines a <i>no-SQL</i> object approach with JSON and Qt APIs to provide applications reliable and powerful storage capabilities. The C++ and QML APIs interact with the <a href="http://engin.io">Enginio Data Storage</a> servers from Digia.</p>
<ul>
<li><a href="http://engin.io">Enginio by Digia</a></li>
<li><a href="../qtenginiooverview/enginio-index.html">Enginio</a> - API for developers</li>
</ul>
</div>
<!-- @@@topics-data-storage.html -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2014 Digia Plc and/or its
   subsidiaries. Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Digia, Qt and their respective logos are trademarks of Digia Plc     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>