<!DOCTYPE html>
<html>
<head>
<title>db.js</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" media="all" href="doc-style.css" />
<script src="doc-filelist.js"></script>
<script>
var relativeDir = "", thisFile = "mnt/share/fabien/bak/code/node/ep_mypads/dbjs", defaultSidebar = true;
</script>
<script src="doc-script.js"></script>
</head>
<body>
<div id="sidebar_wrapper">
<div id="sidebar_switch">
<span class="tree">Files</span>
<span class="headings">Headings</span>
</div>
<div id="tree"></div>
<div id="headings">
<div class="heading h1">
<a href="#database%20module">Database Module</a>
</div>
<div class="heading h2">
<a href="#license">License</a>
</div>
<div class="heading h2">
<a href="#description">Description</a>
</div>
</div>
</div>
<div id="sidebar-toggle"></div>
<div id="container"><div class="background highlight"></div>
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="docs"><div class="dox">
<div class="summary">
<div class="pilwrap" id="database%20module">
<h1>
<a href="#database%20module" name="database%20module" class="pilcrow">¶</a>
Database Module
</h1>
</div>
</div>
<div class="body">
<div class="pilwrap" id="license">
<h2>
<a href="#license" name="license" class="pilcrow">¶</a>
License
</h2>
</div>
<p>Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at</p>
<p><a href='http://www.apache.org/licenses/LICENSE-2.0'>http://www.apache.org/licenses/LICENSE-2.0</a></p>
<p>Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.</p>
<div class="pilwrap" id="description">
<h2>
<a href="#description" name="description" class="pilcrow">¶</a>
Description
</h2>
</div>
<p>This module consists only on a wrapper around etherpad database.</p>
</div>
</div>
</td>
<td class="code highlight"><div class="highlight"><pre><span class="nx">module</span><span class="p">.</span><span class="nx">exports</span> <span class="o">=</span> <span class="p">(</span><span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
<span class="s1">'use strict'</span><span class="p">;</span>
<span class="kd">var</span> <span class="nx">db</span><span class="p">;</span>
<span class="k">try</span> <span class="p">{</span>
</pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-2" id="section-2">¶</a>
</div>
<p>Normal case : when installed as a plugin</p>
</td>
<td class="code highlight"><div class="highlight"><pre>
<span class="nx">db</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'ep_etherpad-lite/node/db/DB'</span><span class="p">).</span><span class="nx">db</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">catch</span> <span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
</pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-3" id="section-3">¶</a>
</div>
<div class="dox">
<div class="summary"><p>Testing case : we need to mock the database connection, using ueberDB and
coherent default configuration with eptherpad-lite one.</p>
</div>
<div class="body">
</div>
</div>
</td>
<td class="code highlight"><div class="highlight"><pre>
<span class="kd">var</span> <span class="nx">ueberDB</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'ueberDB'</span><span class="p">);</span>
<span class="nx">db</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">ueberDB</span><span class="p">.</span><span class="nx">database</span><span class="p">(</span><span class="s1">'dirty'</span><span class="p">,</span> <span class="p">{</span> <span class="nx">filename</span><span class="o">:</span> <span class="s1">'./test.db'</span> <span class="p">});</span>
<span class="nx">db</span><span class="p">.</span><span class="nx">init</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{});</span>
<span class="p">}</span>
<span class="k">return</span> <span class="nx">db</span><span class="p">;</span>
<span class="p">}).</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
</pre></div>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>