<htmlxmlns="http://www.w3.org/1999/xhtml"><head><title>SqliteUtils (infer.IBase.SqliteUtils)</title><linkrel="stylesheet"href="../../../odoc.css"/><metacharset="utf-8"/><metaname="generator"content="odoc 1.5.1"/><metaname="viewport"content="width=device-width,initial-scale=1.0"/><scriptsrc="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><divclass="content"><header><nav><ahref="../index.html">Up</a>–<ahref="../../index.html">infer</a>»<ahref="../index.html">IBase</a>» SqliteUtils</nav><h1>Module <code>IBase.SqliteUtils</code></h1></header><dl><dtclass="spec exception"id="exception-Error"><ahref="#exception-Error"class="anchor"></a><code><spanclass="keyword">exception</span></code><code><spanclass="exception">Error</span><spanclass="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><dtclass="spec value"id="val-check_result_code"><ahref="#val-check_result_code"class="anchor"></a><code><spanclass="keyword">val</span> check_result_code : Sqlite3.db <span>-></span><span>log:string</span><span>-></span> Sqlite3.Rc.t <span>-></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, raise <ahref="index.html#exception-Error"><code>Error</code></a>.</p></dd></dl><dl><dtclass="spec value"id="val-exec"><ahref="#val-exec"class="anchor"></a><code><spanclass="keyword">val</span> exec : Sqlite3.db <span>-></span><span>log:string</span><span>-></span><span>stmt:string</span><span>-></span> unit</code></dt><dd><p>Execute the given Sqlite <code>stmt</code> and check the result with <ahref="index.html#val-check_result_code"><code>check_result_code</code></a>.</p></dd></dl><dl><dtclass="spec value"id="val-finalize"><ahref="#val-finalize"class="anchor"></a><code><spanclass="keyword">val</span> finalize : Sqlite3.db <span>-></span><span>log:string</span><span>-></span> Sqlite3.stmt <span>-></span> unit</code></dt><dd><p>Finalize the given <code>stmt</code>. Raises <ahref="index.html#exception-Error"><code>Error</code></a> on failure.</p></dd></dl><dl><dtclass="spec value"id="val-result_fold_rows"><ahref="#val-result_fold_rows"class="anchor"></a><code><spanclass="keyword">val</span> result_fold_rows : <span>?⁠finalize:bool</span><span>-></span> Sqlite3.db <span>-></span><span>log:string</span><span>-></span> Sqlite3.stmt <span>-></span><span>init:<spanclass="type-var">'a</span></span><span>-></span><span>f:<span>(<spanclass="type-var">'a</span><span>-></span> Sqlite3.stmt <span>-></span><spanclass="type-var">'a</span>)</span></span><span>-></span><spanclass="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><dtclass="spec value"id="val-result_fold_single_column_rows"><ahref="#val-result_fold_single_column_rows"class="anchor"></a><code><spanclass="keyword">val</span> result_fold_single_column_rows : <span>?⁠finalize:bool</span><span>-></span> Sqlite3.db <span>-></span><span>log:string</span><span>-></span> Sqlite3.stmt <span>-></span><span>init:<spanclass="type-var">'b</span></span><span>-></span><span>f:<span>(<spanclass="type-var">'b</span><span>-></span> Sqlite3.Data.t <span>-></span><spanclass="type-var">'b</span>)</span></span><span>-></span><spanclass="type-var">'b</span></code></dt><dd><p>Like <ahref="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><dtclass="spec value"id="val-result_option"><a