pragma.html

来自「sqlite 3.3.8 支持加密的版本」· HTML 代码 · 共 657 行 · 第 1/3 页

HTML
657
字号
            exactly once, with the third parameter set to 0 (NULL). This is to enable programs
            that use the sqlite3_exec() API to retrieve column-names even when a query returns
            no data.
          </p>
          <a name="pragma_encoding"></a></li>
        <li>
          <p>
            <b>PRAGMA encoding;
              <br />
              PRAGMA encoding = "UTF-8";
              <br />
              PRAGMA encoding = "UTF-16";
              <br />
              PRAGMA encoding = "UTF-16le";
              <br />
              PRAGMA encoding = "UTF-16be";</b></p>
          <p>
            In first form, if the main database has already been created, then this pragma returns
            the text encoding used by the main database, one of "UTF-8", "UTF-16le" (little-endian
            UTF-16 encoding) or "UTF-16be" (big-endian UTF-16 encoding). If the main database
            has not already been created, then the value returned is the text encoding that
            will be used to create the main database, if it is created by this session.</p>
          <p>
            The second and subsequent forms of this pragma are only useful if the main database
            has not already been created. In this case the pragma sets the encoding that the
            main database will be created with if it is created by this session. The string
            "UTF-16" is interpreted as "UTF-16 encoding using native machine byte-ordering".
            If the second and subsequent forms are used after the database file has already
            been created, they have no effect and are silently ignored.</p>
          <p>
            Once an encoding has been set for a database, it cannot be changed.</p>
          <p>
            Databases created by the ATTACH command always use the same encoding as the main
            database.</p>
          <a name="pragma_full_column_names"></a></li>
        <li>
          <p>
            <b>PRAGMA full_column_names;
              <br />
              PRAGMA full_column_names = </b><i>0 | 1</i><b>;</b></p>
          <p>
            Query or change the full-column-names flag. This flag affects the way SQLite names
            columns of data returned by SELECT statements when the expression for the column
            is a table-column name or the wildcard "*". Normally, such result columns are named
            &lt;table-name/alias&gt;&lt;column-name&gt; if the SELECT statement joins two or
            more tables together, or simply &lt;column-name&gt; if the SELECT statement queries
            a single table. When the full-column-names flag is set, such columns are always
            named &lt;table-name/alias&gt; &lt;column-name&gt; regardless of whether or not
            a join is performed.
          </p>
          <p>
            If both the short-column-names and full-column-names are set, then the behaviour
            associated with the full-column-names flag is exhibited.
          </p>
          <a name="pragma_fullfsync"></a></li>
        <li>
          <p>
            <b>PRAGMA fullfsync
              <br />
              PRAGMA fullfsync = </b><i>0 | 1</i><b>;</b></p>
          <p>
            Query or change the fullfsync flag. This flag affects determines whether or not
            the F_FULLFSYNC syncing method is used on systems that support it. The default value
            is off. As of this writing (2006-02-10) only Mac OS X supports F_FULLFSYNC.
          </p>
          <a name="pragma_legacy_file_format"></a></li>
        <li>
          <p>
            <b>PRAGMA legacy_file_format;
              <br />
              PRAGMA legacy_file_format = <i>ON | OFF</i></b></p>
          <p>
            This pragma sets or queries the value of the legacy_file_format flag. When this
            flag is on, new SQLite databases are created in a file format that is readable and
            writable by all versions of SQLite going back to 3.0.0. When the flag is off, new
            databases are created using the latest file format which might to be readable or
            writable by older versions of SQLite.</p>
          <p>
            This flag only effects newly created databases. It has no effect on databases that
            already exists.</p>
          <a name="pragma_page_size"></a></li>
        <li>
          <p>
            <b>PRAGMA page_size;
              <br />
              PRAGMA page_size = </b><i>bytes</i><b>;</b></p>
          <p>
            Query or set the page-size of the database. The page-size may only be set if the
            database has not yet been created. The page size must be a power of two greater
            than or equal to 512 and less than or equal to 8192. The upper limit may be modified
            by setting the value of macro SQLITE_MAX_PAGE_SIZE during compilation. The maximum
            upper bound is 32768.
          </p>
          <a name="pragma_read_uncommitted"></a></li>
        <li>
          <p>
            <b>PRAGMA read_uncommitted;
              <br />
              PRAGMA read_uncommitted = </b><i>0 | 1</i><b>;</b></p>
          <p>
            Query, set, or clear READ UNCOMMITTED isolation. The default isolation level for
            SQLite is SERIALIZABLE. Any process or thread can select READ UNCOMMITTED isolation,
            but SERIALIZABLE will still be used except between connections that share a common
            page and schema cache. Cache sharing is enabled using the <a href="capi3ref.html#sqlite3_enable_shared_cache">
              sqlite3_enable_shared_cache()</a> API and is only available between connections
            running the same thread. Cache sharing is off by default.
          </p>
          <a name="pragma_short_column_names"></a></li>
        <li>
          <p>
            <b>PRAGMA short_column_names;
              <br />
              PRAGMA short_column_names = </b><i>0 | 1</i><b>;</b></p>
          <p>
            Query or change the short-column-names flag. This flag affects the way SQLite names
            columns of data returned by SELECT statements when the expression for the column
            is a table-column name or the wildcard "*". Normally, such result columns are named
            &lt;table-name/alias&gt;lt;column-name&gt; if the SELECT statement joins two or
            more tables together, or simply &lt;column-name&gt; if the SELECT statement queries
            a single table. When the short-column-names flag is set, such columns are always
            named &lt;column-name&gt; regardless of whether or not a join is performed.
          </p>
          <p>
            If both the short-column-names and full-column-names are set, then the behaviour
            associated with the full-column-names flag is exhibited.
          </p>
          <a name="pragma_synchronous"></a></li>
        <li>
          <p>
            <b>PRAGMA synchronous;
              <br />
              PRAGMA synchronous = FULL; </b>(2)<b>
                <br />
                PRAGMA synchronous = NORMAL; </b>(1)<b>
                  <br />
                  PRAGMA synchronous = OFF; </b>(0)</p>
          <p>
            Query or change the setting of the "synchronous" flag. The first (query) form will
            return the setting as an integer. When synchronous is FULL (2), the SQLite database
            engine will pause at critical moments to make sure that data has actually been written
            to the disk surface before continuing. This ensures that if the operating system
            crashes or if there is a power failure, the database will be uncorrupted after rebooting.
            FULL synchronous is very safe, but it is also slow. When synchronous is NORMAL,
            the SQLite database engine will still pause at the most critical moments, but less
            often than in FULL mode. There is a very small (though non-zero) chance that a power
            failure at just the wrong time could corrupt the database in NORMAL mode. But in
            practice, you are more likely to suffer a catastrophic disk failure or some other
            unrecoverable hardware fault. With synchronous OFF (0), SQLite continues without
            pausing as soon as it has handed data off to the operating system. If the application
            running SQLite crashes, the data will be safe, but the database might become corrupted
            if the operating system crashes or the computer loses power before that data has
            been written to the disk surface. On the other hand, some operations are as much
            as 50 or more times faster with synchronous OFF.
          </p>
          <p>
            In SQLite version 2, the default value is NORMAL. For version 3, the default was
            changed to FULL.
          </p>
          <a name="pragma_temp_store"></a></li>
        <li>
          <p>
            <b>PRAGMA temp_store;
              <br />
              PRAGMA temp_store = DEFAULT;</b> (0)<b>
                <br />
                PRAGMA temp_store = FILE;</b> (1)<b>
                  <br />
                  PRAGMA temp_store = MEMORY;</b> (2)</p>
          <p>
            Query or change the setting of the "<b>temp_store</b>" parameter. When temp_store
            is DEFAULT (0), the compile-time C preprocessor macro TEMP_STORE is used to determine
            where temporary tables and indices are stored. When temp_store is MEMORY (2) temporary
            tables and indices are kept in memory. When temp_store is FILE (1) temporary tables
            and indices are stored in a file. The <a href="#pragma_temp_store_directory">temp_store_directory</a>
            pragma can be used to specify the directory containing this file. <b>FILE</b> is
            specified. When the temp_store setting is changed, all existing temporary tables,
            indices, triggers, and views are immediately deleted.</p>
          <p>
            It is possible for the library compile-time C preprocessor symbol TEMP_STORE to
            override this pragma setting. The following table summarizes the interaction of
            the TEMP_STORE preprocessor macro and the temp_store pragma:</p>
          <blockquote>
            <table border="1" cellpadding="2">
              <tr>
                <th valign="bottom">
                  TEMP_STORE</th>
                <th valign="bottom">
                  PRAGMA<br />
                  temp_store</th>
                <th>
                  Storage used for<br />
                  TEMP tables and indices</th>
              </tr>
              <tr>
                <td align="middle">
                  0</td>
                <td align="middle">
                  <em>any</em></td>
                <td align="middle">
                  file</td>
              </tr>
              <tr>
                <td align="middle">
                  1</td>
                <td align="middle">
                  0</td>
                <td align="middle">
                  file</td>
              </tr>
              <tr>
                <td align="middle">
                  1</td>
                <td align="middle">
                  1</td>
                <td align="middle">
                  file</td>
              </tr>
              <tr>
                <td align="middle">

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?