/usr/share/gtk-doc/html/libgda-5.0/libgda-sql.html is in libgda-5.0-doc 5.2.4-9.
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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>gda-sql: GNOME Data Access 5 manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GNOME Data Access 5 manual">
<link rel="up" href="part_tools.html" title="Part IV. GDA Tools">
<link rel="prev" href="libgda-tools-introduction.html" title="Introduction">
<link rel="next" href="libgda-tools-list-config.html" title="gda-list-config-5.0">
<meta name="generator" content="GTK-Doc V1.27 (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="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="part_tools.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="libgda-tools-introduction.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="libgda-tools-list-config.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="chapter">
<div class="titlepage"><div><div><h2 class="title">
<a name="libgda-sql"></a><span class="command"><strong>gda-sql</strong></span>
</h2></div></div></div>
<p>
The <span class="command"><strong>gda-sql</strong></span> tool is an interactive command line tool to run SQL commands and work
with dictionaries. This tool has got several options, use the <code class="option">--help</code> option
to list them all, or consult the man page (<span class="command"><strong>man gda-sql</strong></span>)
</p>
<p>
For example to list the installed providers, do:
</p>
<pre class="programlisting">
[prompt]> gda-sql -L
Installed providers list
Provider | Description
---------------+------------------------------------------------------------------------------------
Berkeley-DB | Provider for Berkeley databases
Firebird | Provider for Firebird databases
FirebirdEmbed | Provider for embedded Firebird databases
Ldap | Provider for database where tables are based on data contained in an LDAP directory
MSAccess | Provider for Microsoft Access files
[...]
</pre>
<p>
To list the configured data sources (DSN):
</p>
<pre class="programlisting">
[prompt]> gda-sql -l
List of defined data sources
DSN | Provider | Description | Connection string | Username | Global
----------+----------+--------------------------------------+------------------------------+----------+-------
SalesTest | SQLite | Test database for a sales department | DB_DIR=/adir;DB_NAME=data.db | | FALSE
[...]
</pre>
<p>
To run an interactive session, just specify a DSN or a connection string using
the "<provider>://<connection string>"
format (such as for example "Firebird://DATABASE=/path/to/dbfile.fdb"), or set
the GDA_SQL_CNC environment variable to contain that string, and run the command without any argument,
for example:
</p>
<pre class="programlisting">
[prompt]> gda-sql PostgreSQL://DB_NAME=sales
Welcome to the GDA SQL console, version 3.99.3
Type: .copyright to show usage and distribution terms
.? for help with internal commands
.q (or CTRL-D) to quit
(the '.' can be replaced by a '\')
or any query terminated by a semicolon
Opening connection 'c0' for: PostgreSQL://DB_NAME=sales
Getting database schema information, this may take some time... Done.
c0>
</pre>
<p>
Note that the "c0" is the prompt for the first opened connection.
</p>
<p>
Several connections can be opened at once (with only one "active" at any given time), by specifying
all of them on the command line, or by using the <code class="option">\c</code>
and <code class="option">\close</code> to manage (open, change, close) the connections; the prompt contains
the name of the current connection used. The following example opens two connections, one for the "pgsales"
DSN, and one for the "PostgreSQL://DB_NAME=sales" connection string, and shows the usage of the ".c" command
to list the opened connections:
</p>
<pre class="programlisting">
[prompt]> gda-sql-5.0 pgsales PostgreSQL://DB_NAME=sales
Welcome to the GDA SQL console, version 3.99.3
Type: .copyright to show usage and distribution terms
.? for help with internal commands
.q (or CTRL-D) to quit
(the '.' can be replaced by a '\')
or any query terminated by a semicolon
Opening connection 'pgsales' for: pgsales
Opening connection 'c1' for: PostgreSQL://DB_NAME=sales
Getting database schema information, this may take some time... Done.
c1> .c
List of opened connections
Name | Provider | DSN or connection string | Username
--------+------------+--------------------------+---------
pgsales | PostgreSQL | pgsales |
c1 | PostgreSQL | DB_NAME=sales |
(2 rows)
c1>
</pre>
<p>
</p>
<p>
Here is another sample session showing how to use variables in statements:
</p>
<pre class="programlisting">
[prompt]> gda-sql-5.0 -p SQLite -c "DB_DIR=.;DB_NAME=sales_test"
Welcome to the GDA SQL console, version 3.1.2
Type: \copyright to show usage and distribution terms
\? for help with internal commands
\q (or CTRL-D) to quit
or any query terminated by a semicolon
c0> select * from customers;
id | name | default_served_by | country | city
---+-----------------+-------------------+---------+-----
2 | Ed Lamton | 4 | SP | MDR
3 | Lew Bonito | 1 | FR | TLS
4 | Mark Lawrencep | NULL | SP | MDR
9 | Greg Popoff | 2 | SP | MDR
10 | Vladimir Zirkov | 4 | NULL | NULL
c0> \set the_id 9
c0> select * from customers where id= ##the_id;
id | name | default_served_by | country | city
---+-------------+-------------------+---------+-----
9 | Greg Popoff | 2 | SP | MDR
c0>
</pre>
<p>
</p>
<p>
See the <a class="link" href="gda-sql.html" title="Part VII. Gda SQL console's user manual">Gda SQL console tool manual section</a> for more information.
</p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.27</div>
</body>
</html>
|