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.3 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>IBase__SqliteUtils (infer.IBase__SqliteUtils)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.0"/><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">infer</a> &#x00BB; IBase__SqliteUtils</nav><h1>Module <code>IBase__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, raise <a href="index.html#exception-Error"><code>Error</code></a>.</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 <a href="index.html#val-check_result_code"><code>check_result_code</code></a>.</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 value" id="val-result_option"><a href="#val-result_option" class="anchor"></a><code><span class="keyword">val</span> result_option : <span>?&#8288;finalize:bool</span> <span>&#45;&gt;</span> Sqlite3.db <span>&#45;&gt;</span> <span>log:string</span> <span>&#45;&gt;</span> <span>read_row:<span>(Sqlite3.stmt <span>&#45;&gt;</span> <span class="type-var">'a</span>)</span></span> <span>&#45;&gt;</span> Sqlite3.stmt <span>&#45;&gt;</span> <span><span class="type-var">'a</span> option</span></code></dt><dd><p>Same as <a href="index.html#val-result_fold_rows"><code>result_fold_rows</code></a> but asserts that at most one row is returned.</p></dd></dl><dl><dt class="spec value" id="val-result_single_column_option"><a href="#val-result_single_column_option" class="anchor"></a><code><span class="keyword">val</span> result_single_column_option : <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>Sqlite3.Data.t option</span></code></dt><dd><p>Same as <a href="index.html#val-result_fold_single_column_rows"><code>result_fold_single_column_rows</code></a> but asserts that at most one row is returned.</p></dd></dl><dl><dt class="spec value" id="val-result_unit"><a href="#val-result_unit" class="anchor"></a><code><span class="keyword">val</span> result_unit : <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> unit</code></dt><dd><p>Same as <a href="index.html#val-result_fold_rows"><code>result_fold_rows</code></a> but asserts that no row is returned.</p></dd></dl><dl><dt class="spec value" id="val-db_close"><a href="#val-db_close" class="anchor"></a><code><span class="keyword">val</span> db_close : Sqlite3.db <span>&#45;&gt;</span> unit</code></dt><dd><p>Close the given database and asserts that it was effective. Raises <a href="index.html#exception-Error"><code>Error</code></a> if not.</p></dd></dl><dl><dt class="spec value" id="val-with_transaction"><a href="#val-with_transaction" class="anchor"></a><code><span class="keyword">val</span> with_transaction : Sqlite3.db <span>&#45;&gt;</span> <span>f:<span>(unit <span>&#45;&gt;</span> unit)</span></span> <span>&#45;&gt;</span> unit</code></dt><dd><p>Execute <code>f</code> within an explicit sqlite transaction.</p></dd></dl><dl><dt class="spec module-type" id="module-type-Data"><a href="#module-type-Data" class="anchor"></a><code><span class="keyword">module</span> <span class="keyword">type</span> <a href="module-type-Data/index.html">Data</a> = <span class="keyword">sig</span> ... <span class="keyword">end</span></code></dt><dd><p>An API commonly needed to store and retrieve objects from the database</p></dd></dl><dl><dt class="spec module" id="module-MarshalledDataForComparison"><a href="#module-MarshalledDataForComparison" class="anchor"></a><code><span class="keyword">module</span> <a href="MarshalledDataForComparison/index.html">MarshalledDataForComparison</a> : <span class="keyword">functor</span> (<a href="MarshalledDataForComparison/argument-1-D/index.html">D</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span>) <span>&#45;&gt;</span> <a href="index.html#module-type-Data">Data</a> <span class="keyword">with</span> <span class="keyword">type</span> <a href="MarshalledDataForComparison/index.html#type-t">t</a> = <a href="MarshalledDataForComparison/argument-1-D/index.html#type-t">D.t</a></code></dt><dd><p>A default implementation of the Data API that encodes every objects as marshalled blobs with no sharing</p></dd></dl><dl><dt class="spec module" id="module-MarshalledDataNOTForComparison"><a href="#module-MarshalledDataNOTForComparison" class="anchor"></a><code><span class="keyword">module</span> <a href="MarshalledDataNOTForComparison/index.html">MarshalledDataNOTForComparison</a> : <span class="keyword">functor</span> (<a href="MarshalledDataNOTForComparison/argument-1-D/index.html">D</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span>) <span>&#45;&gt;</span> <a href="index.html#module-type-Data">Data</a> <span class="keyword">with</span> <span class="keyword">type</span> <a href="MarshalledDataNOTForComparison/index.html#type-t">t</a> = <a href="MarshalledDataNOTForComparison/argument-1-D/index.html#type-t">D.t</a></code></dt><dd><p>A default implementation of the Data API that encodes every objects as marshalled blobs</p></dd></dl><dl><dt class="spec module" id="module-MarshalledNullableDataNOTForComparison"><a href="#module-MarshalledNullableDataNOTForComparison" class="anchor"></a><code><span class="keyword">module</span> <a href="MarshalledNullableDataNOTForComparison/index.html">MarshalledNullableDataNOTForComparison</a> : <span class="keyword">functor</span> (<a href="MarshalledNullableDataNOTForComparison/argument-1-D/index.html">D</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span>) <span>&#45;&gt;</span> <a href="index.html#module-type-Data">Data</a> <span class="keyword">with</span> <span class="keyword">type</span> <a href="MarshalledNullableDataNOTForComparison/index.html#type-t">t</a> = <span><a href="MarshalledNullableDataNOTForComparison/argument-1-D/index.html#type-t">D.t</a> option</span></code></dt><dd><p>A default implementation of the Data API that encodes None as a NULL SQLite value</p></dd></dl></div></body></html>