You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
9.4 KiB

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>InferBase__SqliteUtils (InferBase.InferBase__SqliteUtils)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc %%VERSION%%"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> <a href="../index.html">InferBase</a> &#x00BB; InferBase__SqliteUtils</nav><h1>Module <code>InferBase__SqliteUtils</code></h1></header><dl><dt class="spec exception" id="exception-Error"><a href="#exception-Error" class="anchor"></a><code><span class="keyword">exception</span> </code><code><span class="exception">Error</span> <span class="keyword">of</span> string</code></dt><dd><p>The functions in this module tend to raise more often than their counterparts in <code>Sqlite3</code>. In particular, they may raise if the <code>Sqlite3.Rc.t</code> result of certain operations is unexpected.</p></dd></dl><dl><dt class="spec value" id="val-check_result_code"><a href="#val-check_result_code" class="anchor"></a><code><span class="keyword">val</span> check_result_code : Sqlite3.db <span>&#45;&gt;</span> <span>log:string</span> <span>&#45;&gt;</span> Sqlite3.Rc.t <span>&#45;&gt;</span> unit</code></dt><dd><p>Assert that the result is either <code>Sqlite3.Rc.OK</code> or <code>Sqlite3.Rc.ROW</code>. If the result is not valid, then if <code>fatal</code> is set raise <a href="index.html#exception-Error"><code>Error</code></a>, otherwise log the error and proceed.</p></dd></dl><dl><dt class="spec value" id="val-exec"><a href="#val-exec" class="anchor"></a><code><span class="keyword">val</span> exec : Sqlite3.db <span>&#45;&gt;</span> <span>log:string</span> <span>&#45;&gt;</span> <span>stmt:string</span> <span>&#45;&gt;</span> unit</code></dt><dd><p>Execute the given Sqlite <code>stmt</code> and check the result with <code>check_result_code ~fatal:true</code>.</p></dd></dl><dl><dt class="spec value" id="val-finalize"><a href="#val-finalize" class="anchor"></a><code><span class="keyword">val</span> finalize : Sqlite3.db <span>&#45;&gt;</span> <span>log:string</span> <span>&#45;&gt;</span> Sqlite3.stmt <span>&#45;&gt;</span> unit</code></dt><dd><p>Finalize the given <code>stmt</code>. Raises <a href="index.html#exception-Error"><code>Error</code></a> on failure.</p></dd></dl><dl><dt class="spec value" id="val-result_fold_rows"><a href="#val-result_fold_rows" class="anchor"></a><code><span class="keyword">val</span> result_fold_rows : <span>?&#8288;finalize:bool</span> <span>&#45;&gt;</span> Sqlite3.db <span>&#45;&gt;</span> <span>log:string</span> <span>&#45;&gt;</span> Sqlite3.stmt <span>&#45;&gt;</span> <span>init:<span class="type-var">'a</span></span> <span>&#45;&gt;</span> <span>f:<span>(<span class="type-var">'a</span> <span>&#45;&gt;</span> Sqlite3.stmt <span>&#45;&gt;</span> <span class="type-var">'a</span>)</span></span> <span>&#45;&gt;</span> <span class="type-var">'a</span></code></dt><dd><p>Fold <code>f</code> over each row of the result. <code>f</code> must not access the database.</p></dd></dl><dl><dt class="spec value" id="val-result_fold_single_column_rows"><a href="#val-result_fold_single_column_rows" class="anchor"></a><code><span class="keyword">val</span> result_fold_single_column_rows : <span>?&#8288;finalize:bool</span> <span>&#45;&gt;</span> Sqlite3.db <span>&#45;&gt;</span> <span>log:string</span> <span>&#45;&gt;</span> Sqlite3.stmt <span>&#45;&gt;</span> <span>init:<span class="type-var">'b</span></span> <span>&#45;&gt;</span> <span>f:<span>(<span class="type-var">'b</span> <span>&#45;&gt;</span> Sqlite3.Data.t <span>&#45;&gt;</span> <span class="type-var">'b</span>)</span></span> <span>&#45;&gt;</span> <span class="type-var">'b</span></code></dt><dd><p>Like <a href="index.html#val-result_fold_rows"><code>result_fold_rows</code></a> but pass column 0 of each row in the results to <code>f</code>.</p></dd></dl><dl><dt class="spec val