<!-- 95% W3C COMPLIANT, 95% CSS FREE, RAW HTML --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <title>BiglooA ``practical Scheme compiler''User manual for version 3.2bJune 2009</title> <style type="text/css"> <!-- pre { font-family: monospace } tt { font-family: monospace } code { font-family: monospace } p.flushright { text-align: right } p.flushleft { text-align: left } span.sc { font-variant: small-caps } span.sf { font-family: sans-serif } span.skribetitle { font-family: sans-serif; font-weight: bolder; font-size: x-large; } span.refscreen { } span.refprint { display: none; } --> </style> </head> <body class="chapter" bgcolor="#ffffff"> <table width="100%" class="skribetitle" cellspacing="0" cellpadding="0"><tbody> <tr><td align="center" bgcolor="#8381de"><div class="skribetitle"><strong><big><big><big>18. Bigloo<br/>A ``practical Scheme compiler''<br/>User manual for version 3.2b<br/>June 2009 -- Database library</big></big></big></strong></div><center> </center> </td></tr></tbody></table> <table cellpadding="3" cellspacing="0" width="100%" class="skribe-margins"><tr> <td align="left" valign="top" class="skribe-left-margin" width="20%" bgcolor="#dedeff"><div class="skribe-left-margin"> <br/><center id='center29361' ><table width="97%" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" frame="box" rules="none"><tbody> <tr bgcolor="#8381de"><th id="tc29351" align="center" colspan="1"><font color="#ffffff"><strong id='bold29349' >main page</strong></font></th></tr> <tr bgcolor="#ffffff"><td id="tc29358" align="center" colspan="1"><table width="100%" border="0" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc29354" align="left" valign="top" colspan="1"><strong id='bold29353' >top:</strong></td><td id="tc29355" align="right" valign="top" colspan="1"><a href="bigloo.html#Bigloo-A-``practical-Scheme-compiler''-User-manual-for-version-3.2b-June-2009" class="inbound">Bigloo<br/>A ``practical Scheme compiler''<br/>User manual for version 3.2b<br/>June 2009</a></td></tr> </tbody></table> </td></tr> </tbody></table> </center> <br/><br/><center id='center29371' ><table width="97%" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" frame="box" rules="none"><tbody> <tr bgcolor="#8381de"><th id="tc29365" align="center" colspan="1"><font color="#ffffff"><strong id='bold29363' >Database library</strong></font></th></tr> <tr bgcolor="#ffffff"><td id="tc29368" align="center" colspan="1"><table cellspacing="1" cellpadding="1" width="100%" class="toc"> <tbody> <tr><td valign="top" align="left">18.1</td><td colspan="4" width="100%"><a href="bigloo-19.html#SQLite">SQLite</a></td></tr> </tbody> </table> </td></tr> </tbody></table> </center> <br/><br/><center id='center29381' ><table width="97%" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" frame="box" rules="none"><tbody> <tr bgcolor="#8381de"><th id="tc29375" align="center" colspan="1"><font color="#ffffff"><strong id='bold29373' >Chapters</strong></font></th></tr> <tr bgcolor="#ffffff"><td id="tc29378" align="center" colspan="1"><table cellspacing="1" cellpadding="1" width="100%" class="toc"> <tbody> <tr><td valign="top" align="left"></td><td colspan="4" width="100%"><a href="bigloo-1.html#Acknowledgements">Acknowledgements</a></td></tr> <tr><td valign="top" align="left">1</td><td colspan="4" width="100%"><a href="bigloo-2.html#Table-of-contents">Table of contents</a></td></tr> <tr><td valign="top" align="left">2</td><td colspan="4" width="100%"><a href="bigloo-3.html#Overview-of-Bigloo">Overview of Bigloo</a></td></tr> <tr><td valign="top" align="left">3</td><td colspan="4" width="100%"><a href="bigloo-4.html#Modules">Modules</a></td></tr> <tr><td valign="top" align="left">4</td><td colspan="4" width="100%"><a href="bigloo-5.html#Core-Language">Core Language</a></td></tr> <tr><td valign="top" align="left">5</td><td colspan="4" width="100%"><a href="bigloo-6.html#DSSSL-support">DSSSL support</a></td></tr> <tr><td valign="top" align="left">6</td><td colspan="4" width="100%"><a href="bigloo-7.html#Standard-Library">Standard Library</a></td></tr> <tr><td valign="top" align="left">7</td><td colspan="4" width="100%"><a href="bigloo-8.html#Pattern-Matching">Pattern Matching</a></td></tr> <tr><td valign="top" align="left">8</td><td colspan="4" width="100%"><a href="bigloo-9.html#Fast-search">Fast search</a></td></tr> <tr><td valign="top" align="left">9</td><td colspan="4" width="100%"><a href="bigloo-10.html#Structures-and-Records">Structures and Records</a></td></tr> <tr><td valign="top" align="left">10</td><td colspan="4" width="100%"><a href="bigloo-11.html#Object-System">Object System</a></td></tr> <tr><td valign="top" align="left">11</td><td colspan="4" width="100%"><a href="bigloo-12.html#Regular-parsing">Regular parsing</a></td></tr> <tr><td valign="top" align="left">12</td><td colspan="4" width="100%"><a href="bigloo-13.html#Lalr(1)-parsing">Lalr(1) parsing</a></td></tr> <tr><td valign="top" align="left">13</td><td colspan="4" width="100%"><a href="bigloo-14.html#Posix-Regular-Expressions">Posix Regular Expressions</a></td></tr> <tr><td valign="top" align="left">14</td><td colspan="4" width="100%"><a href="bigloo-15.html#Command-Line-Parsing">Command Line Parsing</a></td></tr> <tr><td valign="top" align="left">15</td><td colspan="4" width="100%"><a href="bigloo-16.html#Cryptography">Cryptography</a></td></tr> <tr><td valign="top" align="left">16</td><td colspan="4" width="100%"><a href="bigloo-17.html#Errors-Assertions-and-Traces">Errors, Assertions, and Traces</a></td></tr> <tr><td valign="top" align="left">17</td><td colspan="4" width="100%"><a href="bigloo-18.html#Threads">Threads</a></td></tr> <tr><td valign="top" align="left">18</td><td colspan="4" width="100%"><a href="bigloo-19.html#Database-library">Database library</a></td></tr> <tr><td valign="top" align="left">19</td><td colspan="4" width="100%"><a href="bigloo-20.html#Multimedia-library">Multimedia library</a></td></tr> <tr><td valign="top" align="left">20</td><td colspan="4" width="100%"><a href="bigloo-21.html#Mail-library">Mail library</a></td></tr> <tr><td valign="top" align="left">21</td><td colspan="4" width="100%"><a href="bigloo-22.html#Eval-and-code-interpretation">Eval and code interpretation</a></td></tr> <tr><td valign="top" align="left">22</td><td colspan="4" width="100%"><a href="bigloo-23.html#Macro-expansion">Macro expansion</a></td></tr> <tr><td valign="top" align="left">23</td><td colspan="4" width="100%"><a href="bigloo-24.html#Parameters">Parameters</a></td></tr> <tr><td valign="top" align="left">24</td><td colspan="4" width="100%"><a href="bigloo-25.html#Explicit-typing">Explicit typing</a></td></tr> <tr><td valign="top" align="left">25</td><td colspan="4" width="100%"><a href="bigloo-26.html#The-C-interface">The C interface</a></td></tr> <tr><td valign="top" align="left">26</td><td colspan="4" width="100%"><a href="bigloo-27.html#The-Java-interface">The Java interface</a></td></tr> <tr><td valign="top" align="left">27</td><td colspan="4" width="100%"><a href="bigloo-28.html#Bigloo-Libraries">Bigloo Libraries</a></td></tr> <tr><td valign="top" align="left">28</td><td colspan="4" width="100%"><a href="bigloo-29.html#Extending-the-Runtime-System">Extending the Runtime System</a></td></tr> <tr><td valign="top" align="left">29</td><td colspan="4" width="100%"><a href="bigloo-30.html#SRFIs">SRFIs</a></td></tr> <tr><td valign="top" align="left">30</td><td colspan="4" width="100%"><a href="bigloo-31.html#Compiler-description">Compiler description</a></td></tr> <tr><td valign="top" align="left">31</td><td colspan="4" width="100%"><a href="bigloo-32.html#User-Extensions">User Extensions</a></td></tr> <tr><td valign="top" align="left">32</td><td colspan="4" width="100%"><a href="bigloo-33.html#Bigloo-Development-Environment">Bigloo Development Environment</a></td></tr> <tr><td valign="top" align="left">33</td><td colspan="4" width="100%"><a href="bigloo-34.html#Global-Index">Global Index</a></td></tr> <tr><td valign="top" align="left">34</td><td colspan="4" width="100%"><a href="bigloo-35.html#Library-Index">Library Index</a></td></tr> <tr><td valign="top" align="left"></td><td colspan="4" width="100%"><a href="bigloo-36.html#Bibliography">Bibliography</a></td></tr> </tbody> </table> </td></tr> </tbody></table> </center> </div></td> <td align="left" valign="top" class="skribe-body"><div class="skribe-body"> <a name="Database-library" class="mark"></a><a name="g20014" class="mark"></a> Bigloo supports database programming. The current version proposes a SQLite binding.<br/><br/> <!-- SQLite --> <a name="SQLite"></a> <div class="section-atitle"><table width="100%"><tr><td bgcolor="#dedeff"><h3><font color="black">18.1 SQLite</font> </h3></td></tr></table> </div><div class="section"> <a name="SQLite" class="mark"></a><a name="g20017" class="mark"></a> The Bigloo's C back-end supports SQL queries. It relies on the SQLite library (<a href="http://www.sqlite.org/">http://www.sqlite.org/</a>). The SQLite binding is accessible to Bigloo via the <code id='code20019' >sqlite</code> library. Here is an example of module that uses this library.<br/><br/><center id='center20031' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20029' >(<font color="#1919af"><strong id='bold29382' >module</strong></font> <font color="#1919af"><strong id='bold29384' >example1</strong></font> (<font color="#1919af"><strong id='bold29386' >library</strong></font> <font color="#1919af"><strong id='bold29388' >sqlite</strong></font>))<br/><br/>(<strong id='bold29390' >let</strong> ((db (<strong id='bold29391' >instantiate</strong><font color="#00cf00"><strong id='bold29392' >::sqlite</strong></font>))) ...) </pre> </td></tr> </tbody></table></center> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g20033" class="mark"></a><a name="sqlite" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc20037" align="left" colspan="1"><strong id='bold20035' >sqlite</strong><em id='it20036' ></em></td><td id="tc20038" align="right" colspan="1">Bigloo Sqlite class</td></tr> </tbody></table> <center id='center20046' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20044' >(<strong id='bold29394' >class</strong> sqlite (path<font color="#00cf00"><strong id='bold29395' >::bstring</strong></font> read-only (default <font color="red">":memory:"</font>))) </pre> </td></tr> </tbody></table></center> The instances of the class <code id='code20047' >sqlite</code> hold SQLite databases. A database may be permanently stored on a disk or loaded in memory. The class attribute <code id='code20048' >path</code> is the location on the disk where the database is stored. The special path <code id='code20049' >:memory:</code> denotes in-memory databases. When an instance is created a SQLite database is <em id='emph20050' >opened</em>.<br/><br/>Example: <center id='center20061' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20059' >(<font color="#6959cf"><strong id='bold29398' >define</strong></font> <font color="#6959cf"><strong id='bold29400' >db1</strong></font> (<strong id='bold29402' >instantiate</strong><font color="#00cf00"><strong id='bold29403' >::sqlite</strong></font> (path <font color="red">"/tmp/foo.db"</font>))) (<font color="#6959cf"><strong id='bold29406' >define</strong></font> <font color="#6959cf"><strong id='bold29408' >db2</strong></font> (<strong id='bold29410' >instantiate</strong><font color="#00cf00"><strong id='bold29411' >::sqlite</strong></font>)) </pre> </td></tr> </tbody></table></center> Binds the global variable <code id='code20063' ><em id='it20062' >db1</em></code> to a database that is stored on the file system at location <code id='code20064' >/tmp/foo.db</code>. This example also binds the global variable <code id='code20066' ><em id='it20065' >db2</em></code> to an in-memory SQLite database. </td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g20070" class="mark"></a><a name="sqlite-close" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc20076" align="left" colspan="1"><strong id='bold20072' >sqlite-close</strong><em id='it20075' > <code id='code20074' ><em id='it20073' >sqlite</em></code></em></td><td id="tc20077" align="right" colspan="1">Bigloo Sqlite function</td></tr> </tbody></table> This function closes a database previously opened by creating an instance of the class <code id='code20080' >sqlite</code>.<br/><br/>Example: <center id='center20089' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20087' >(<strong id='bold29413' >let</strong> ((db (<strong id='bold29414' >instantiate</strong><font color="#00cf00"><strong id='bold29415' >::sqlite</strong></font>))) (sqlite-exec db <font color="red">"CREATE TABLE table1 (x INTEGER, y INTEGER)"</font>) (sqlite-exec db <font color="red">"INSERT INTO table1 VALUES( ~a, ~a )"</font> 1 4) (sqlite-close db)) </pre> </td></tr> </tbody></table></center> </td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g20093" class="mark"></a><a name="sqlite-format" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc20101" align="left" colspan="1"><strong id='bold20095' >sqlite-format</strong><em id='it20100' > <code id='code20097' ><em id='it20096' >string</em></code> <code id='code20099' ><em id='it20098' >arg</em></code> ...</em></td><td id="tc20102" align="right" colspan="1">Bigloo Sqlite function</td></tr> </tbody></table> Constructs a string of characters representing an SQLite commands. This function acts as <code id='code20105' >format</code> (see <a href="bigloo-7.html#Input-and-Output" class="inbound">Input and Output</a>). It is augmented with three additional escape sequence: <code id='code20106' >~q</code>, <code id='code20107' >~k</code>, and <code id='code20108' >~l</code>. The first one build a string of characters where the characters denoting SQL strings (i.e., the character <code id='code20109' >'</code>) is automatically escaped. The escape character <code id='code20110' >~k</code> introduces a list of SQL strings. The escape character <code id='code20111' >~l</code> introduces a SQL list.<br/><br/>Summary of all escape codes: <ul class="itemize" id='itemize20128' ><li><code id='code20113' >~a</code> The corresponding value is inserted into the string as if printed with display. </li> <li><code id='code20115' >~s</code> The corresponding value is inserted into the string as if printed with write. </li> <li><code id='code20117' >~%</code> A newline is inserted. </li> <li><code id='code20119' >~~</code> A tilde <code id='code20120' >~</code> is inserted. </li> <li><code id='code20122' >~q</code> An SQL escaped string. </li> <li><code id='code20124' >~l</code> Introduces a list (comma separated). </li> <li><code id='code20126' >~k</code> Introduces a list of SQL strings. </li> </ul> Examples:<br/><br/><center id='center20155' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20153' >(<font color="#1919af"><strong id='bold29419' >module</strong></font> <font color="#1919af"><strong id='bold29421' >example</strong></font> (<font color="#1919af"><strong id='bold29423' >library</strong></font> <font color="#1919af"><strong id='bold29425' >sqlite</strong></font>))<br/><br/>(sqlite-format <font color="red">"~a"</font> <font color="red">"foo'bar"</font>) => <font color="red">"foo'bar"</font> (sqlite-format <font color="red">"~q"</font> <font color="red">"foo'bar"</font>) => <font color="red">"'foo''bar'"</font> (sqlite-format <font color="red">"~a"</font> '(<font color="red">"foo'bar"</font> <font color="red">"foo"</font>)) => <font color="red">"(foo'bar foo)"</font> (sqlite-format <font color="red">"~k"</font> '(<font color="red">"foo'bar"</font> <font color="red">"foo"</font>)) => <font color="red">"'foo''bar','foo'"</font> (sqlite-format <font color="red">"~l"</font> '(<font color="red">"foo'bar"</font> <font color="red">"foo"</font>)) => <font color="red">"foo'bar,foo"</font> </pre> </td></tr> </tbody></table></center> </td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g20159" class="mark"></a><a name="sqlite-exec" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc20169" align="left" colspan="1"><strong id='bold20161' >sqlite-exec</strong><em id='it20168' > <code id='code20163' ><em id='it20162' >sqlite</em></code> <code id='code20165' ><em id='it20164' >string</em></code> <code id='code20167' ><em id='it20166' >arg</em></code> ...</em></td><td id="tc20170" align="right" colspan="1">Bigloo Sqlite function</td></tr> </tbody></table> The function <code id='code20173' >sqlite-exec</code> <em id='emph20174' >executes</em> an SQLite command. The command is the built by implicitly invoking <code id='code20175' >sqlite-format</code> on <code id='code20177' ><em id='it20176' >string</em></code> and the optional <code id='code20179' ><em id='it20178' >arg</em></code> arguments. This function returns a single element, the first one returned by the SQL engine.<br/><br/>Example: <center id='center20196' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20194' >(<font color="#1919af"><strong id='bold29445' >module</strong></font> <font color="#1919af"><strong id='bold29447' >example</strong></font> (<font color="#1919af"><strong id='bold29449' >library</strong></font> <font color="#1919af"><strong id='bold29451' >sqlite</strong></font>))<br/><br/>(<font color="#6959cf"><strong id='bold29453' >define</strong></font> <font color="#6959cf"><strong id='bold29455' >*db*</strong></font> (<strong id='bold29457' >instantiate</strong><font color="#00cf00"><strong id='bold29458' >::sqlite</strong></font>))<br/><br/>(sqlite-exec *db* <font color="red">"CREATE TABLE foo (x INTEGER, y INTEGER)"</font>) (for-each (<strong id='bold29461' >lambda</strong> (x) (sqlite-exec *db* <font color="red">"INSERT INTO foo VALUES(~A, ~A)"</font> x (* x x))) (iota 10)) (sqlite-exec *db* <font color="red">"SELECT * FROM foo"</font>) => 9 </pre> </td></tr> </tbody></table></center> </td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g20200" class="mark"></a><a name="sqlite-eval" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc20212" align="left" colspan="1"><strong id='bold20202' >sqlite-eval</strong><em id='it20211' > <code id='code20204' ><em id='it20203' >sqlite</em></code> <code id='code20206' ><em id='it20205' >procedure</em></code> <code id='code20208' ><em id='it20207' >string</em></code> <code id='code20210' ><em id='it20209' >arg</em></code> ...</em></td><td id="tc20213" align="right" colspan="1">Bigloo Sqlite function</td></tr> </tbody></table> The function <code id='code20216' >sqlite-eval</code> invokes a SQLite command built by implicitly invoking <code id='code20217' >sqlite-format</code> on <code id='code20219' ><em id='it20218' >string</em></code> and the optional <code id='code20221' ><em id='it20220' >arg</em></code> arguments. The result of the function is built by applying <code id='code20223' ><em id='it20222' >procedure</em></code> to the first value returned by the SQLite call.<br/><br/>Note: user callback (<code id='code20226' ><em id='it20225' >procedure</em></code>) <strong id='bold20227' >must not</strong> exit. That is they must not invoke a function create by <code id='code20228' >bind-exit</code>. Exiting from a callback will leave the database in a inconsistent state that prevent transactions to be rolled back. </td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g20232" class="mark"></a><a name="sqlite-map" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc20244" align="left" colspan="1"><strong id='bold20234' >sqlite-map</strong><em id='it20243' > <code id='code20236' ><em id='it20235' >sqlite</em></code> <code id='code20238' ><em id='it20237' >procedure</em></code> <code id='code20240' ><em id='it20239' >string</em></code> <code id='code20242' ><em id='it20241' >arg</em></code> ...</em></td><td id="tc20245" align="right" colspan="1">Bigloo Sqlite function</td></tr> </tbody></table> The function <code id='code20248' >sqlite-map</code> invokes a SQLite command built by implicitly invoking <code id='code20249' >sqlite-format</code> on <code id='code20251' ><em id='it20250' >string</em></code> and the optional <code id='code20253' ><em id='it20252' >arg</em></code> arguments. The result is a list whose elements are built by applying <code id='code20255' ><em id='it20254' >procedure</em></code> to all the values returned by the SQLite call.<br/><br/>Note: user callback (<code id='code20258' ><em id='it20257' >procedure</em></code>) <strong id='bold20259' >must not</strong> exit. That is they must not invoke a function create by <code id='code20260' >bind-exit</code>. Exiting from a callback will leave the database in a inconsistent state that prevent transactions to be rolled back. Example:<br/><br/><center id='center20278' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20276' >(<font color="#1919af"><strong id='bold29464' >module</strong></font> <font color="#1919af"><strong id='bold29466' >example</strong></font> (<font color="#1919af"><strong id='bold29468' >library</strong></font> <font color="#1919af"><strong id='bold29470' >sqlite</strong></font>))<br/><br/>(<font color="#6959cf"><strong id='bold29472' >define</strong></font> <font color="#6959cf"><strong id='bold29474' >*db*</strong></font> (<strong id='bold29476' >instantiate</strong><font color="#00cf00"><strong id='bold29477' >::sqlite</strong></font>))<br/><br/>(sqlite-exec *db* <font color="red">"CREATE TABLE foo (x INTEGER, y INTEGER)"</font>) (for-each (<strong id='bold29480' >lambda</strong> (x) (sqlite-exec *db* <font color="red">"INSERT INTO foo VALUES(~A, ~A)"</font> x (* x x))) (iota 10)) (sqlite-map *db* (<strong id='bold29482' >lambda</strong> (s1 s2) (+ (string->integer s1) (string->integer s2))) <font color="red">"SELECT * FROM foo"</font>) => (0 2 6 12 20 30 42 56 72 90) </pre> </td></tr> </tbody></table></center> </td></tr> </tbody></table><br/> Example2: <center id='center20316' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20314' >(<font color="#1919af"><strong id='bold29484' >module</strong></font> <font color="#1919af"><strong id='bold29486' >example</strong></font> (<font color="#1919af"><strong id='bold29488' >library</strong></font> <font color="#1919af"><strong id='bold29490' >sqlite</strong></font>))<br/><br/>(<font color="#6959cf"><strong id='bold29492' >define</strong></font> <font color="#6959cf"><strong id='bold29494' >*db*</strong></font> (<strong id='bold29496' >instantiate</strong><font color="#00cf00"><strong id='bold29497' >::sqlite</strong></font>))<br/><br/>(sqlite-exec *db* <font color="red">"CREATE TABLE foo (x INTEGER, y INTEGER)"</font>) (for-each (<strong id='bold29500' >lambda</strong> (x) (sqlite-exec *db* <font color="red">"INSERT INTO foo VALUES(~A, ~A)"</font> x (* x x))) (iota 10)) (sqlite-map *db* vector <font color="red">"SELECT * FROM foo"</font>) => '(#(<font color="red">"0"</font> <font color="red">"0"</font>) #(<font color="red">"1"</font> <font color="red">"1"</font>) #(<font color="red">"2"</font> <font color="red">"4"</font>) #(<font color="red">"3"</font> <font color="red">"9"</font>) #(<font color="red">"4"</font> <font color="red">"16"</font>) #(<font color="red">"5"</font> <font color="red">"25"</font>) #(<font color="red">"6"</font> <font color="red">"36"</font>) #(<font color="red">"7"</font> <font color="red">"49"</font>) #(<font color="red">"8"</font> <font color="red">"64"</font>) #(<font color="red">"9"</font> <font color="red">"81"</font>)) </pre> </td></tr> </tbody></table></center> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g20318" class="mark"></a><a name="sqlite-last-insert-rowid" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc20324" align="left" colspan="1"><strong id='bold20320' >sqlite-last-insert-rowid</strong><em id='it20323' > <code id='code20322' ><em id='it20321' >sqlite</em></code></em></td><td id="tc20325" align="right" colspan="1">Bigloo Sqlite function</td></tr> </tbody></table> Returns the SQLite <em id='emph20328' >rowid</em> of the last inserted row. </td></tr> </tbody></table><br/><br/><br/><br/><br/><br/><br/><br/> </div><br> </div></td> </tr></table><div class="skribe-ending"> <hr> <p class="ending" id='paragraph29528' ><font size="-1"> This <span class="sc">Html</span> page has been produced by <a href="http://www.inria.fr/mimosa/fp/Skribe" class="http">Skribe</a>. <br/> Last update <em id='it29526' >Tue Jun 2 11:43:27 2009</em>.</font></p></div> </body> </html>