Files
Nim/db_common.html
github-actions[bot] ef3d9e7b38 Deploy to GitHub pages
2025-12-28 15:55:52 +00:00

347 lines
25 KiB
HTML

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>src/db_connector/db_common</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">src/db_connector/db_common</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#DbColumn" title="DbColumn = object
name*: string ## name of the column
tableName*: string ## name of the table the column belongs to (optional)
typ*: DbType ## type of the column
primaryKey*: bool ## is this a primary key?
foreignKey*: bool ## is this a foreign key?">DbColumn</a></li>
<li><a class="reference" href="#DbColumns" title="DbColumns = seq[DbColumn]">DbColumns</a></li>
<li><a class="reference" href="#DbEffect" title="DbEffect = object of IOEffect">DbEffect</a></li>
<li><a class="reference" href="#DbError" title="DbError = object of IOError">DbError</a></li>
<li><a class="reference" href="#DbType" title="DbType = object
kind*: DbTypeKind ## the kind of the described type
notNull*: bool ## does the type contain NULL?
name*: string ## the name of the type
size*: Natural ## the size of the datatype; 0 if of variable size
maxReprLen*: Natural ## maximal length required for the representation
precision*, scale*: Natural ## precision and scale of the number
min*, max*: BiggestInt ## the minimum and maximum of allowed values
validValues*: seq[string] ## valid values of an enum or a set">DbType</a></li>
<li><a class="reference" href="#DbTypeKind" title="DbTypeKind = enum
dbUnknown, ## unknown datatype
dbSerial, ## datatype used for primary auto-increment keys
dbNull, ## datatype used for the NULL value
dbBit, ## bit datatype
dbBool, ## boolean datatype
dbBlob, ## blob datatype
dbFixedChar, ## string of fixed length
dbVarchar, ## string datatype
dbJson, ## JSON datatype
dbXml, ## XML datatype
dbInt, ## some integer type
dbUInt, ## some unsigned integer type
dbDecimal, ## decimal numbers (fixed-point number)
dbFloat, ## some floating point type
dbDate, ## a year-month-day description
dbTime, ## HH:MM:SS information
dbDatetime, ## year-month-day and HH:MM:SS information,
## plus optional time or timezone information
dbTimestamp, ## Timestamp values are stored as the number of seconds
## since the epoch ('1970-01-01 00:00:00' UTC).
dbTimeInterval, ## an interval [a,b] of times
dbEnum, ## some enum
dbSet, ## set of enum values
dbArray, ## an array of values
dbComposite, ## composite type (record, struct, etc)
dbUrl, ## a URL
dbUuid, ## a UUID
dbInet, ## an IP address
dbMacAddress, ## a MAC address
dbGeometry, ## some geometric type
dbPoint, ## Point on a plane (x,y)
dbLine, ## Infinite line ((x1,y1),(x2,y2))
dbLseg, ## Finite line segment ((x1,y1),(x2,y2))
dbBox, ## Rectangular box ((x1,y1),(x2,y2))
dbPath, ## Closed or open path (similar to polygon) ((x1,y1),...)
dbPolygon, ## Polygon (similar to closed path) ((x1,y1),...)
dbCircle, ## Circle &lt;(x,y),r&gt; (center point and radius)
dbUser1, ## user definable datatype 1 (for unknown extensions)
dbUser2, ## user definable datatype 2 (for unknown extensions)
dbUser3, ## user definable datatype 3 (for unknown extensions)
dbUser4, ## user definable datatype 4 (for unknown extensions)
dbUser5 ## user definable datatype 5 (for unknown extensions)">DbTypeKind</a></li>
<li><a class="reference" href="#ReadDbEffect" title="ReadDbEffect = object of DbEffect">ReadDbEffect</a></li>
<li><a class="reference" href="#SqlQuery" title="SqlQuery = distinct string">SqlQuery</a></li>
<li><a class="reference" href="#WriteDbEffect" title="WriteDbEffect = object of DbEffect">WriteDbEffect</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">dbError
<li><a class="reference" href="#dbError%2Cstring" title="dbError(msg: string)">dbError(msg: string)</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">sql
<li><a class="reference" href="#sql.t%2Cstring" title="sql(query: string): SqlQuery">sql(query: string): SqlQuery</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc"><div class="admonition admonition-info"><span class="admonition-info-text"><b>Note:</b></span>
In order to use this module, run <tt class="docutils literal"><span class="pre"><span class="Identifier">nimble</span> <span class="Identifier">install</span> <span class="Identifier">db_connector</span></span></tt>.</div>
<p>Common datatypes and definitions for all <tt class="docutils literal"><span class="pre"><span class="Identifier">db_</span><span class="Operator">*.</span><span class="Identifier">nim</span></span></tt> ( <a class="reference external" href="db_mysql.html">db_mysql</a>, <a class="reference external" href="db_postgres.html">db_postgres</a>, and <a class="reference external" href="db_sqlite.html">db_sqlite</a>) modules.</p>
</p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="DbColumn">
<dt><pre><a href="db_common.html#DbColumn"><span class="Identifier">DbColumn</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">name</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">string</span> <span class="Comment">## name of the column</span>
<span class="Identifier">tableName</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">string</span> <span class="Comment">## name of the table the column belongs to (optional)</span>
<span class="Identifier">typ</span><span class="Operator">*</span><span class="Other">:</span> <a href="db_common.html#DbType"><span class="Identifier">DbType</span></a> <span class="Comment">## type of the column</span>
<span class="Identifier">primaryKey</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Comment">## is this a primary key?</span>
<span class="Identifier">foreignKey</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Comment">## is this a foreign key?</span></pre></dt>
<dd>
information about a database column
</dd>
</div>
<div id="DbColumns">
<dt><pre><a href="db_common.html#DbColumns"><span class="Identifier">DbColumns</span></a> <span class="Other">=</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="db_common.html#DbColumn"><span class="Identifier">DbColumn</span></a><span class="Other">]</span></pre></dt>
<dd>
</dd>
</div>
<div id="DbEffect">
<dt><pre><a href="db_common.html#DbEffect"><span class="Identifier">DbEffect</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">IOEffect</span></pre></dt>
<dd>
effect that denotes a database operation
</dd>
</div>
<div id="DbError">
<dt><pre><a href="db_common.html#DbError"><span class="Identifier">DbError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">IOError</span></pre></dt>
<dd>
exception that is raised if a database error occurs
</dd>
</div>
<div id="DbType">
<dt><pre><a href="db_common.html#DbType"><span class="Identifier">DbType</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">kind</span><span class="Operator">*</span><span class="Other">:</span> <a href="db_common.html#DbTypeKind"><span class="Identifier">DbTypeKind</span></a> <span class="Comment">## the kind of the described type</span>
<span class="Identifier">notNull</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Comment">## does the type contain NULL?</span>
<span class="Identifier">name</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">string</span> <span class="Comment">## the name of the type</span>
<span class="Identifier">size</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Natural</span> <span class="Comment">## the size of the datatype; 0 if of variable size</span>
<span class="Identifier">maxReprLen</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Natural</span> <span class="Comment">## maximal length required for the representation</span>
<span class="Identifier">precision</span><span class="Operator">*</span><span class="Other">,</span> <span class="Identifier">scale</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Natural</span> <span class="Comment">## precision and scale of the number</span>
<span class="Identifier">min</span><span class="Operator">*</span><span class="Other">,</span> <span class="Identifier">max</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">BiggestInt</span> <span class="Comment">## the minimum and maximum of allowed values</span>
<span class="Identifier">validValues</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> <span class="Comment">## valid values of an enum or a set</span></pre></dt>
<dd>
describes a database type
</dd>
</div>
<div id="DbTypeKind">
<dt><pre><a href="db_common.html#DbTypeKind"><span class="Identifier">DbTypeKind</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">dbUnknown</span><span class="Other">,</span> <span class="Comment">## unknown datatype</span>
<span class="Identifier">dbSerial</span><span class="Other">,</span> <span class="Comment">## datatype used for primary auto-increment keys</span>
<span class="Identifier">dbNull</span><span class="Other">,</span> <span class="Comment">## datatype used for the NULL value</span>
<span class="Identifier">dbBit</span><span class="Other">,</span> <span class="Comment">## bit datatype</span>
<span class="Identifier">dbBool</span><span class="Other">,</span> <span class="Comment">## boolean datatype</span>
<span class="Identifier">dbBlob</span><span class="Other">,</span> <span class="Comment">## blob datatype</span>
<span class="Identifier">dbFixedChar</span><span class="Other">,</span> <span class="Comment">## string of fixed length</span>
<span class="Identifier">dbVarchar</span><span class="Other">,</span> <span class="Comment">## string datatype</span>
<span class="Identifier">dbJson</span><span class="Other">,</span> <span class="Comment">## JSON datatype</span>
<span class="Identifier">dbXml</span><span class="Other">,</span> <span class="Comment">## XML datatype</span>
<span class="Identifier">dbInt</span><span class="Other">,</span> <span class="Comment">## some integer type</span>
<span class="Identifier">dbUInt</span><span class="Other">,</span> <span class="Comment">## some unsigned integer type</span>
<span class="Identifier">dbDecimal</span><span class="Other">,</span> <span class="Comment">## decimal numbers (fixed-point number)</span>
<span class="Identifier">dbFloat</span><span class="Other">,</span> <span class="Comment">## some floating point type</span>
<span class="Identifier">dbDate</span><span class="Other">,</span> <span class="Comment">## a year-month-day description</span>
<span class="Identifier">dbTime</span><span class="Other">,</span> <span class="Comment">## HH:MM:SS information</span>
<span class="Identifier">dbDatetime</span><span class="Other">,</span> <span class="Comment">## year-month-day and HH:MM:SS information,</span>
<span class="Comment">## plus optional time or timezone information</span>
<span class="Identifier">dbTimestamp</span><span class="Other">,</span> <span class="Comment">## Timestamp values are stored as the number of seconds</span>
<span class="Comment">## since the epoch ('1970-01-01 00:00:00' UTC).</span>
<span class="Identifier">dbTimeInterval</span><span class="Other">,</span> <span class="Comment">## an interval [a,b] of times</span>
<span class="Identifier">dbEnum</span><span class="Other">,</span> <span class="Comment">## some enum</span>
<span class="Identifier">dbSet</span><span class="Other">,</span> <span class="Comment">## set of enum values</span>
<span class="Identifier">dbArray</span><span class="Other">,</span> <span class="Comment">## an array of values</span>
<span class="Identifier">dbComposite</span><span class="Other">,</span> <span class="Comment">## composite type (record, struct, etc)</span>
<span class="Identifier">dbUrl</span><span class="Other">,</span> <span class="Comment">## a URL</span>
<span class="Identifier">dbUuid</span><span class="Other">,</span> <span class="Comment">## a UUID</span>
<span class="Identifier">dbInet</span><span class="Other">,</span> <span class="Comment">## an IP address</span>
<span class="Identifier">dbMacAddress</span><span class="Other">,</span> <span class="Comment">## a MAC address</span>
<span class="Identifier">dbGeometry</span><span class="Other">,</span> <span class="Comment">## some geometric type</span>
<span class="Identifier">dbPoint</span><span class="Other">,</span> <span class="Comment">## Point on a plane (x,y)</span>
<span class="Identifier">dbLine</span><span class="Other">,</span> <span class="Comment">## Infinite line ((x1,y1),(x2,y2))</span>
<span class="Identifier">dbLseg</span><span class="Other">,</span> <span class="Comment">## Finite line segment ((x1,y1),(x2,y2))</span>
<span class="Identifier">dbBox</span><span class="Other">,</span> <span class="Comment">## Rectangular box ((x1,y1),(x2,y2))</span>
<span class="Identifier">dbPath</span><span class="Other">,</span> <span class="Comment">## Closed or open path (similar to polygon) ((x1,y1),...)</span>
<span class="Identifier">dbPolygon</span><span class="Other">,</span> <span class="Comment">## Polygon (similar to closed path) ((x1,y1),...)</span>
<span class="Identifier">dbCircle</span><span class="Other">,</span> <span class="Comment">## Circle &lt;(x,y),r&gt; (center point and radius)</span>
<span class="Identifier">dbUser1</span><span class="Other">,</span> <span class="Comment">## user definable datatype 1 (for unknown extensions)</span>
<span class="Identifier">dbUser2</span><span class="Other">,</span> <span class="Comment">## user definable datatype 2 (for unknown extensions)</span>
<span class="Identifier">dbUser3</span><span class="Other">,</span> <span class="Comment">## user definable datatype 3 (for unknown extensions)</span>
<span class="Identifier">dbUser4</span><span class="Other">,</span> <span class="Comment">## user definable datatype 4 (for unknown extensions)</span>
<span class="Identifier">dbUser5</span> <span class="Comment">## user definable datatype 5 (for unknown extensions)</span></pre></dt>
<dd>
a superset of datatypes that might be supported.
</dd>
</div>
<div id="ReadDbEffect">
<dt><pre><a href="db_common.html#ReadDbEffect"><span class="Identifier">ReadDbEffect</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="db_common.html#DbEffect"><span class="Identifier">DbEffect</span></a></pre></dt>
<dd>
effect that denotes a read operation
</dd>
</div>
<div id="SqlQuery">
<dt><pre><a href="db_common.html#SqlQuery"><span class="Identifier">SqlQuery</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">string</span></pre></dt>
<dd>
an SQL query string
</dd>
</div>
<div id="WriteDbEffect">
<dt><pre><a href="db_common.html#WriteDbEffect"><span class="Identifier">WriteDbEffect</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="db_common.html#DbEffect"><span class="Identifier">DbEffect</span></a></pre></dt>
<dd>
effect that denotes a write operation
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="dbError-procs-all">
<div id="dbError,string">
<dt><pre><span class="Keyword">proc</span> <a href="#dbError%2Cstring"><span class="Identifier">dbError</span></a><span class="Other">(</span><span class="Identifier">msg</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span> {.<span class="Identifier">noreturn</span><span class="Other">,</span> <span class="Identifier">noinline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">DbError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
raises an DbError exception with message <tt class="docutils literal"><span class="pre"><span class="Identifier">msg</span></span></tt>.
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="sql-templates-all">
<div id="sql.t,string">
<dt><pre><span class="Keyword">template</span> <a href="#sql.t%2Cstring"><span class="Identifier">sql</span></a><span class="Other">(</span><span class="Identifier">query</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <a href="db_common.html#SqlQuery"><span class="Identifier">SqlQuery</span></a></pre></dt>
<dd>
<p>constructs a SqlQuery from the string <tt class="docutils literal"><span class="pre"><span class="Identifier">query</span></span></tt>. This is supposed to be used as a raw-string-literal modifier: <tt class="docutils literal"><span class="pre"><span class="RawData">sql&quot;update user set counter = counter + 1&quot;</span></span></tt></p>
<p>If assertions are turned off, it does nothing. If assertions are turned on, later versions will check the string for valid syntax.</p>
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-12-28 15:55:36 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>