tmud-2.10.1/benchmark/
tmud-2.10.1/cmd/
tmud-2.10.1/cmd/objects/
tmud-2.10.1/cmd/tiny/
tmud-2.10.1/doc/classes/SQLite/
tmud-2.10.1/doc/classes/SQLite3/
tmud-2.10.1/doc/classes/TernaryTrie/
tmud-2.10.1/doc/files/cmd/objects/
tmud-2.10.1/doc/files/cmd/tiny/
tmud-2.10.1/doc/files/lib/
tmud-2.10.1/doc/files/lib/engine/
tmud-2.10.1/doc/files/lib/farts/
tmud-2.10.1/farts/
tmud-2.10.1/lib/
tmud-2.10.1/lib/core/
tmud-2.10.1/lib/engine/
tmud-2.10.1/lib/farts/
tmud-2.10.1/logs/
<?xml version="1.0" encoding="iso-8859-1"?>
<!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" lang="en">
<head>
  <title>Class: SQLite::Database</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">SQLite::Database</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/lib/storage/sqlitehash_rb.html">
                lib/storage/sqlitehash.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">
    <div id="diagram">
      <map id="map" name="map">
  <area shape="rect" coords="27,52,107,100"      href="Database.html" alt="Database
" />
  <area shape="rect" coords="16,16,141,111"      href="../SQLite.html" alt="SQLite
" />
</map>
<img src="../../dot/f_49.png" usemap="#map" border="0" alt="dot/f_49.png">
    </div>



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000356">[]</a>&nbsp;&nbsp;
      <a href="#M000357">[]=</a>&nbsp;&nbsp;
      <a href="#M000359">delete</a>&nbsp;&nbsp;
      <a href="#M000358">has_key?</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000356" class="method-detail">
        <a name="M000356"></a>

        <div class="method-heading">
          <a href="#M000356" class="method-signature">
          <span class="method-name">[]</span><span class="method-args">(idx)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000356-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000356-source">
<pre>
<span class="ruby-comment cmt"># File lib/storage/sqlitehash.rb, line 17</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">idx</span>)
      <span class="ruby-identifier">result</span> = <span class="ruby-identifier">execute</span>(<span class="ruby-value str">&quot;select data from tmud where id = ?;&quot;</span>, <span class="ruby-identifier">idx</span>.<span class="ruby-identifier">to_i</span>)
      <span class="ruby-identifier">result</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">first</span> <span class="ruby-value">? </span><span class="ruby-identifier">result</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
    <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000357" class="method-detail">
        <a name="M000357"></a>

        <div class="method-heading">
          <a href="#M000357" class="method-signature">
          <span class="method-name">[]=</span><span class="method-args">(idx, data)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000357-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000357-source">
<pre>
<span class="ruby-comment cmt"># File lib/storage/sqlitehash.rb, line 21</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">idx</span>, <span class="ruby-identifier">data</span>)
      <span class="ruby-identifier">result</span> = <span class="ruby-identifier">execute</span>(<span class="ruby-value str">&quot;insert into tmud values (?, ?);&quot;</span>, <span class="ruby-identifier">idx</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">data</span>)
    <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
      <span class="ruby-identifier">result</span> = <span class="ruby-identifier">execute</span>(<span class="ruby-value str">&quot;update tmud set data = ? where id = ?;&quot;</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">idx</span>.<span class="ruby-identifier">to_i</span>)
    <span class="ruby-keyword kw">ensure</span>
      <span class="ruby-identifier">data</span>
    <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000359" class="method-detail">
        <a name="M000359"></a>

        <div class="method-heading">
          <a href="#M000359" class="method-signature">
          <span class="method-name">delete</span><span class="method-args">(idx)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000359-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000359-source">
<pre>
<span class="ruby-comment cmt"># File lib/storage/sqlitehash.rb, line 32</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">idx</span>)
      <span class="ruby-identifier">result</span> = <span class="ruby-identifier">execute</span>(<span class="ruby-value str">&quot;delete from tmud where id = ?;&quot;</span>, <span class="ruby-identifier">idx</span>.<span class="ruby-identifier">to_i</span>)
    <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
    <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000358" class="method-detail">
        <a name="M000358"></a>

        <div class="method-heading">
          <a href="#M000358" class="method-signature">
          <span class="method-name">has_key?</span><span class="method-args">(idx)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000358-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000358-source">
<pre>
<span class="ruby-comment cmt"># File lib/storage/sqlitehash.rb, line 28</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">idx</span>)
      <span class="ruby-identifier">result</span> = <span class="ruby-identifier">execute</span>(<span class="ruby-value str">&quot;select data from tmud where id = ?;&quot;</span>, <span class="ruby-identifier">idx</span>.<span class="ruby-identifier">to_i</span>)
      <span class="ruby-identifier">result</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">first</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span>
    <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>