~ubuntu-branches/debian/sid/pgadmin3/sid

« back to all changes in this revision

Viewing changes to xtra/pgscript/doc/readme.html

  • Committer: Bazaar Package Importer
  • Author(s): Gerfried Fuchs
  • Date: 2009-07-30 12:27:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090730122716-fddbh42on721bbs2
Tags: 1.10.0-1
* New upstream release.
* Adjusted watch file to match release candidates.
* Updated to Standards-Version 3.8.2:
  - Moved to Section: database.
  - Add DEB_BUILD_OPTIONS support for parallel building.
  - Move from findstring to filter suggestion for DEB_BUILD_OPTIONS parsing.
* pgagent got split into its own separate source package by upstream.
* Exclude Docs.vcproj from installation.
* Move doc-base.enus from pgadmin3 to pgadmin3-data package, the files are
  in there too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<head>
 
3
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
 
4
<link rel="stylesheet" type="text/css" href="../../../docs/en_US/pgadmin3.css" />
 
5
<title>pgScript Readme</title>
 
6
</head>
 
7
<body>
 
8
<pre>                            ___         _      _
 
9
                 _ __  __ _/ __| __ _ _(_)_ __| |_
 
10
                | '_ \/ _` \__ \/ _| '_| | '_ \  _|
 
11
                | .__/\__, |___/\__|_| |_| .__/\__|
 
12
                |_|   |___/              |_|</pre>
 
13
<hr />
 
14
<p><b>Table of Contents</b></p>
 
15
<dl>
 
16
        <dt><a href="#overview">Overview / introduction</a></dt>
 
17
    <dt><a href="#install">pgScript install</a></dt>
 
18
    <dd>
 
19
        <dl>
 
20
            <dt><a href="#requirements">Requirements</a></dt>
 
21
            <dt><a href="#basic">Basic install</a></dt>
 
22
        </dl>
 
23
    </dd>
 
24
    <dt><a href="#usage">Usage</a></dt>
 
25
    <dd>
 
26
        <dl>
 
27
            <dt><a href="#usage1">Synopsis</a></dt>
 
28
            <dt><a href="#usage2">Options</a></dt>
 
29
                        <dt><a href="#usage3">Example</a></dt>
 
30
        </dl>
 
31
    </dd>
 
32
        <dt><a href="#reference">pgScript scripting language reference</a></dt>
 
33
</dl>
 
34
<h2><a id="overview"></a>Overview / introduction</h2>
 
35
<p>pgScript enhances PostgreSQL SQL commands with these additional features:</p>
 
36
<ul>
 
37
    <li>Control-of-flow language</li>
 
38
    <li>Local variables</li>
 
39
    <li>Random data generators</li>
 
40
</ul>
 
41
<p>For instance:</p>
 
42
<pre class="screen">    SET @A = INTEGER(0, 10);           -- Random integer generator into @A
 
43
    IF (SELECT COUNT(*) FROM table)    -- Then table exists
 
44
    BEGIN
 
45
        SET @B = SELECT * FROM table;  -- Stores result of the query in @B
 
46
        INSERT INTO table VALUES (@A); -- Inserts a random integer
 
47
        PRINT @B;                      -- Prints result of the previous query
 
48
    END
 
49
    ELSE                               -- Else table does not exist
 
50
    BEGIN
 
51
        CREATE TABLE table ( ... );    -- Regular PostgreSQL command
 
52
    END</pre>
 
53
<p>pgScript is built along with pgAdmin and can be accessed through the pgAdmin Query Tool. It can also be built as a command-line program. This document explains how to build and use the <u>command-line interface</u>.</p>
 
54
<p>The command-line interface is in <code>xtra/pgscript</code> (this directory) while main pgScript source code is in <code>pgadmin/pgscript</code>. </p>
 
55
<h2><a id="install"></a>pgScript install</h2>
 
56
<h3><a id="requirements"></a>Requirements</h3>
 
57
<p>Linux or MinGW environment (should work on MacOS)</p>
 
58
<p><code>g++.exe</code> (GCC) <code>&gt;=</code> 3.4.x</p>
 
59
<p>wxWidgets <code>&gt;=</code> 2.8.7</p>
 
60
<p>PostgreSQL (libpq) <code>&gt;=</code> 8.0</p>
 
61
<h3><a id="basic"></a>Basic install</h3>
 
62
<p>Go to the root directory of pgAdmin and enter the following
 
63
    command:</p>
 
64
<pre class="screen">./configure</pre>
 
65
<p>Go to the <code>xtra/pgscript</code> directory and enter the following
 
66
    command:</p>
 
67
<pre class="screen">
 
68
make
 
69
./bin/pgScript</pre>
 
70
<p>You can possibly install pgScript binary:</p>
 
71
<pre class="screen">make install</pre>
 
72
<h2><a id="usage"></a>Usage</h2>
 
73
<h3><a id="usage1"></a>Synopsis</h3>
 
74
<p><code class="command">pgScript</code> <code>-h </code><em><code>host</code></em> [<code>-p </code><em><code>port</code></em>] <code>-d </code><em><code>database</code></em> <code>-U </code><em><code>username</code></em> [<code>-W </code><em><code>password</code></em>] [<code>-e </code><em><code>encoding</code></em>] <em><code>inputfile</code></em></p>
 
75
<p>The output is UTF8-encoded. </p>
 
76
<h3><a id="usage2"></a>Options</h3>
 
77
<dl>
 
78
    <dt>-h <em><code>host</code></em></dt>
 
79
    <dd>
 
80
        <p>Database server host to connect to e.g <code>127.0.0.1</code></p>
 
81
    </dd>
 
82
    <dt>-p <em><code>port</code></em></dt>
 
83
    <dd>
 
84
        <p>Database server port number (default: <code>5432</code>)</p>
 
85
    </dd>
 
86
    <dt>-d <em><code>database</code></em></dt>
 
87
    <dd>
 
88
        <p>Database to connect to</p>
 
89
    </dd>
 
90
    <dt>-U <em><code>username</code></em></dt>
 
91
    <dd>
 
92
        <p>Username to use for connecting to the database server</p>
 
93
    </dd>
 
94
    <dt>-W <em><code>password</code></em></dt>
 
95
    <dd>
 
96
        <p>Password to use for connecting to the database server
 
97
            (default: <code>nothing</code>)</p>
 
98
    </dd>
 
99
    <dt>-e <em><code>encoding</code></em></dt>
 
100
    <dd>
 
101
        <p>Encoding of <code>file</code> e.g <code>utf-8</code>, <code>iso-8859-1</code> (default: <code>system
 
102
            encoding</code>)</p>
 
103
    </dd>
 
104
    <dt><em><code>pgScript input
 
105
        file</code></em></dt>
 
106
    <dd>
 
107
        <p>Path to the file to parse with pgScript (.pgs file)</p>
 
108
    </dd>
 
109
</dl>
 
110
<h3><a id="usage3"></a>Example</h3>
 
111
<p><strong class="command">pgScript </strong><code>-h 127.0.0.1 -U postgres -W
 
112
    postgres -d testbase -e "utf-8" script.pgs</code></p>
 
113
<p>This connects to the database <code>127.0.0.1:5432/testbase</code> with the credentials <code>postgres</code>/<code>postgres</code> and parses the UTF-8 encoded file <code>script.pgs</code>. The output is written on screen and is UTF-8 encoded.</p>
 
114
<h2><a id="reference"></a>pgScript scripting language reference</h2>
 
115
<p>Refer to pgScript help page in pgAdmin: <a href="../../../docs/en_US/pgscript.html" target="_blank">pgscript.html</a>. </p>
 
116
</body>
 
117
</html>