/usr/share/gtk-doc/html/libgda-4.0/ch39s02.html is in libgda-4.0-doc 4.2.8-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Internal parameters</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="GNOME Data Access 4 manual">
<link rel="up" href="gda-sql-manual-icommands.html" title="Detailed features">
<link rel="prev" href="gda-sql-manual-icommands.html" title="Detailed features">
<link rel="next" href="ch39s03.html" title="Embedded HTTP server">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="gda-sql-manual-icommands.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="gda-sql-manual-icommands.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GNOME Data Access 4 manual</th>
<td><a accesskey="n" href="ch39s03.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="sect1">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id961086"></a>Internal parameters</h2></div></div></div>
<p>
Variables can be defined using the <span class="command"><strong>.set</strong></span> and <span class="command"><strong>.setex</strong></span> commands.
Variables are then automatically looked for
when executing SQL statements for which a variable is required; they are not typed and are converted to
the correct type when needed. Note that variables are shared by all the opened connections.
</p>
<p>
When setting values, the textual representation must respect the following format:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>for booleans: "true" or "false" (case insensitive)</p></li>
<li class="listitem"><p>for numerical types: the dot as a fraction separator</p></li>
<li class="listitem"><p>for dates, time and timestamp: the ISO 8601 format (dates as "YYYY-MM-DD", time as "HH:MM:SS")
</p></li>
</ul></div>
<p>
</p>
<p>
Use the <span class="command"><strong>.set <variablename> <variable value></strong></span> command to define a variable,
and the <span class="command"><strong>.set</strong></span> command to list all defined variables. The following example illustrates
variables usage:
</p>
<pre class="programlisting">
SalesTest> select * from customers where id = ##theid::int;
ERROR: No internal parameter named 'theid' required by query
SalesTest> .set theid 3
SalesTest> select * from customers where id = ##theid::int;
id | name | default_served_by | country | city
---+------------+-------------------+---------+-----
3 | Lew Bonito | 1 | FR | TLS
(1 row)
SalesTest> .set theid 5
SalesTest> select * from customers where id = ##theid::int;
id | name | default_served_by | country | city
---+------+-------------------+---------+-----
(0 rows)
SalesTest> .set
List of defined parameters
Name | Value
------+------
theid | 5
(1 row)
SalesTest>
</pre>
<p>
</p>
<p>
The <span class="command"><strong>.setex</strong></span> command also sets an internal parameter, it has two usages:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>The <span class="command"><strong>.set <variablename> <filename></strong></span> usage loads the contents
of the named filename into the named variable (usually to be used as a BLOB)</p></li>
<li class="listitem">
<p>The <span class="command"><strong>.set <variablename> <table> <column> <row condition></strong></span>
usage creates a named variable which contents is the value of the <table> table and
<column> column for the row identified by <row condition>. Note that this command will fail
if the <row condition> condition does not return exactly one value.</p>
<p>
The following example defined a "bl10" variable containing the value of the "blob" column in the "blobs" table
for the "id=10" condition:
</p>
<pre class="programlisting">
.setex bl10 blobs blob "id=10"
</pre>
<p>
</p>
</li>
</ul></div>
<p>
</p>
<p>
The <span class="command"><strong>.export</strong></span> command exports to a file the contents of an internal variable or the
the contents of a table's value:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>The <span class="command"><strong>.export <variablename> <filename></strong></span> usage exports the contents
of the named variable into the named filename</p></li>
<li class="listitem"><p>The <span class="command"><strong>.set <table> <column> <row condition> <filename></strong></span>
usage exports the value of the <table> table and
<column> column for the row identified by <row condition>. Note that this command will fail
if the <row condition> condition does not return exactly one value.</p></li>
</ul></div>
<p>
</p>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.17</div>
</body>
</html>
|