pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedpgbash-2.1 released
6+ messages / 4 participants
[nested] [flat]
* pgbash-2.1 released
@ 2000-05-17 07:28 SAKAIDA Masaaki <sakaida@psn.co.jp>
0 siblings, 1 reply; 6+ messages in thread
From: SAKAIDA Masaaki @ 2000-05-17 07:28 UTC (permalink / raw)
To: pgsql-interfaces
Hi,
Please let me report that pgbash-2.1 was released.
(Pgbash is a tool which can execute SQL directly with using all
the functions of a bash shell. And Pgbash has functionality
which is similar to psql.)
* Download Page
http://www.psn.co.jp/PostgreSQL/pgbash/download-e.html
* Example in interactive environment
-------------------
prompt> /usr/local/bin/pgbash .....Start of pgbash
pgbash> connect to db2@xxx.com user sakaida; .....connect to database
# PostgreSQL 7.0.0 on i386-unknown-freebsd2.2.x, compiled by gcc 2.7.x
# CONNECT TO pgbash:5432 AS pgbash USER pgbash
pgbash> select * from test limit 100; | more .....pipeline
code|name |addr
----+----------------+--------
1|sakaida |kobe
2|yumiko |kyoto
(2 rows)
pgbash> select * from test; > /tmp/sel.dat & .....redirect+background_Job
pgbash> addr='Osaka'
pgbash> insert into test values(
> 111,'name', .....new line
> '$addr' .....use shell variable
> );
INSERT 22144 1
pgbash> connect to db3@yyy.com user postgres; > /dev/null
pgbash> set connection db2; .....set current D/B to db2
pgbash> select * from test; &> /tmp/test.dat'.....select db2's test
pgbash> ls /tmp
test.dat
pgbash> exec_sql -d db3 "select * from test3".....change connection to db3
pgbash> begin;
BEGIN
pgbash> declare cur cursor for select * from test;
pgbash> fetch in cur into :AA,:BB; .....set shell variables
pgbash> echo "code=$AA, name=$BB"
code=1, name=sakaida
pgbash> !fetch .....FETCH again
pgbash> !echo .....echo again
code=2, name=yumiko
pgbash> end;
COMMIT
pgbash> disconnect all .....disconnect all connections
pgbash> exit .....End of pgbash
prompt>
--------------------
* Example of a shell script
--------------------
#!/usr/local/bin/pgbash
CONNECT TO postgres;
CONNECT TO dbname2 as db2 user postgres;
SET CONNECTION default;
SELECT * FROM test;
exec_sql -d db2 "SELECT * FROM test2"
#
echo "key data="
read keydata
#
BEGIN;
DECLARE cur CURSOR FOR SELECT * FROM test WHERE col1= $keydata;
declares -i x; let x=0; while(( x < 100 ))
do
FETCH IN cur INTO :_AA :_AA_IND, :_BB ;
if((SQLCODE==SQL_NOT_FOUND)); then
let x=101
else
if(( SQLCODE == 0 && _AA_IND != SQL_NULL )); then
echo "$_AA, $_BB, $_CC"
fi
fi
let x = x+1
done
fi
END;
echo "nFields=$SQLNFIELD FieldName=${SQLFIELDNAME[0]} .."
#
DISCONNECT ALL;
--------------------
* Features
1. Pgbash can talk to 6.5/7.0 backend.
Pgbash(+ 6.5-libpq) can talk to both 6.5 and 7.0 backend.
Pgbash(+ 7.0-libpq) can talk to both 6.5 and 7.0 backend.
Pgbash(+ non-MB-libpq) can talk to both non-MB and MB backend.
Pgbash(+ MB-libpq) can talk to both non-MB and MB backend.
Here, "MB" is MULTIBYTE.
2. It is possible that pgbash manipulates multiple databases using
CONNECT, DISCONNECT and SET CONNECTION (or -d option ).
3. Pgbash has functionality that sets the retrieval result into
the shell variable using FETCH INTO statement.
4. Pgbash has a COPY function which a general user can specify
column names and a file name.
(ex. COPY table( col1,.. ) TO '/tmp/test.dat')
5. It is possible to set CGI mode. In CGI mode, Pgbash switches
the output to HTML, and read the data by GET/POST method, and
read the data of HTTP_COOKIE.
6. Pgbash sets "error code", "error message", "number of tuples",
etc into the shell variable. Therefore, it is possible to know
the condition after the SQL execution.
--
Regards,
SAKAIDA Masaaki -- Osaka, Japan
# I am not good at English ;-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgbash-2.1 released
@ 2000-05-17 13:29 Thomas Lockhart <lockhart@alumni.caltech.edu>
parent: SAKAIDA Masaaki <sakaida@psn.co.jp>
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Lockhart @ 2000-05-17 13:29 UTC (permalink / raw)
To: SAKAIDA Masaaki <sakaida@psn.co.jp>; +Cc: pgsql-interfaces
> Please let me report that pgbash-2.1 was released.
> (Pgbash is a tool which can execute SQL directly with using all
> the functions of a bash shell. And Pgbash has functionality
> which is similar to psql.)
> * Download Page
> http://www.psn.co.jp/PostgreSQL/pgbash/download-e.html
Hello Masaaki. Could we consider packaging pgbash into our postgres
RPMs for Linux? That would make it available on a *lot* more
installations, and would be a very nice addition to the RPMs.
- Thomas
--
Thomas Lockhart lockhart@alumni.caltech.edu
South Pasadena, California
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgbash-2.1 released
@ 2000-05-18 00:45 SAKAIDA Masaaki <sakaida@psn.co.jp>
parent: Thomas Lockhart <lockhart@alumni.caltech.edu>
0 siblings, 1 reply; 6+ messages in thread
From: SAKAIDA Masaaki @ 2000-05-18 00:45 UTC (permalink / raw)
To: Thomas Lockhart <lockhart@alumni.caltech.edu>; +Cc: pgsql-interfaces
Thomas Lockhart <lockhart@alumni.caltech.edu> さん wrote:
> > Please let me report that pgbash-2.1 was released.
> > (Pgbash is a tool which can execute SQL directly with using all
> > the functions of a bash shell. And Pgbash has functionality
> > which is similar to psql.)
> > * Download Page
> > http://www.psn.co.jp/PostgreSQL/pgbash/download-e.html
>
> Hello Masaaki. Could we consider packaging pgbash into our postgres
> RPMs for Linux? That would make it available on a *lot* more
> installations, and would be a very nice addition to the RPMs.
Yes, please :-). I'm glad you like it.
--
Regards,
SAKAIDA Masaaki -- Osaka, Japan
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgbash-2.1 released
@ 2000-05-18 05:10 Thomas Lockhart <lockhart@alumni.caltech.edu>
parent: SAKAIDA Masaaki <sakaida@psn.co.jp>
0 siblings, 2 replies; 6+ messages in thread
From: Thomas Lockhart @ 2000-05-18 05:10 UTC (permalink / raw)
To: SAKAIDA Masaaki <sakaida@psn.co.jp>; Lamar Owen <lamar.owen@wgcr.org>; +Cc: pgsql-interfaces
> > > Please let me report that pgbash-2.1 was released.
> > > (Pgbash is a tool which can execute SQL directly with using all
> > > the functions of a bash shell. And Pgbash has functionality
> > > which is similar to psql.)
> > > * Download Page
> > > http://www.psn.co.jp/PostgreSQL/pgbash/download-e.html
> > Hello Masaaki. Could we consider packaging pgbash into our postgres
> > RPMs for Linux? That would make it available on a *lot* more
> > installations, and would be a very nice addition to the RPMs.
> Yes, please :-). I'm glad you like it.
Lamar, how about it? Packaging it completely separately (as, say,
pgbash-2.1-1.i386.rpm) seems to make it hard to match up with other
postgres-related RPMs. Does postgresql-pgbash-xxx work, or should we
keep it separate? The version number is a problem if we merge it
directly into the postgresql rpm set.
- Thomas
--
Thomas Lockhart lockhart@alumni.caltech.edu
South Pasadena, California
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgbash-2.1 released
@ 2000-05-18 15:08 Karel Zak <zakkr@zf.jcu.cz>
parent: Thomas Lockhart <lockhart@alumni.caltech.edu>
1 sibling, 0 replies; 6+ messages in thread
From: Karel Zak @ 2000-05-18 15:08 UTC (permalink / raw)
To: Thomas Lockhart <lockhart@alumni.caltech.edu>; +Cc: SAKAIDA Masaaki <sakaida@psn.co.jp>; Lamar Owen <lamar.owen@wgcr.org>; pgsql-interfaces
On Thu, 18 May 2000, Thomas Lockhart wrote:
> > > Hello Masaaki. Could we consider packaging pgbash into our postgres
> > > RPMs for Linux? That would make it available on a *lot* more
> > > installations, and would be a very nice addition to the RPMs.
> > Yes, please :-). I'm glad you like it.
>
> Lamar, how about it? Packaging it completely separately (as, say,
> pgbash-2.1-1.i386.rpm) seems to make it hard to match up with other
> postgres-related RPMs. Does postgresql-pgbash-xxx work, or should we
> keep it separate? The version number is a problem if we merge it
> directly into the postgresql rpm set.
>
And what create separate space for pg-family software (like pgbash, pgadmin
pgaccess ...etc)? For software which are not primary devel in pg CVS, but
we want "push" these software to distribution. Create for this software some
web space (like KDE software family) and garante for users simular names
(for example postgresql-softname-version.rpm) and for develepers that their
software will in distributions.
Karel
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgbash-2.1 released
@ 2000-05-20 18:06 Lamar Owen <lamar.owen@wgcr.org>
parent: Thomas Lockhart <lockhart@alumni.caltech.edu>
1 sibling, 0 replies; 6+ messages in thread
From: Lamar Owen @ 2000-05-20 18:06 UTC (permalink / raw)
To: Thomas Lockhart <lockhart@alumni.caltech.edu>; +Cc: SAKAIDA Masaaki <sakaida@psn.co.jp>; pgsql-interfaces
Thomas Lockhart wrote:
> > > > Please let me report that pgbash-2.1 was released.
> > > > (Pgbash is a tool which can execute SQL directly with using all
> > > > the functions of a bash shell. And Pgbash has functionality
> > > > which is similar to psql.)
> > > > * Download Page
> > > > http://www.psn.co.jp/PostgreSQL/pgbash/download-e.html
> > > Hello Masaaki. Could we consider packaging pgbash into our postgres
> > > RPMs for Linux? That would make it available on a *lot* more
> > > installations, and would be a very nice addition to the RPMs.
> > Yes, please :-). I'm glad you like it.
> Lamar, how about it? Packaging it completely separately (as, say,
> pgbash-2.1-1.i386.rpm) seems to make it hard to match up with other
> postgres-related RPMs. Does postgresql-pgbash-xxx work, or should we
> keep it separate? The version number is a problem if we merge it
> directly into the postgresql rpm set.
I'll take a look at it -- it seems to be a nice interface.
We currently have a similar problem with pgaccess, as its version
nnumbers are not in sync with the main release. We simply ignore that
difference -- but, pgaccess is a part of the core tarball.
I am open to suggestions -- I could make a 'postgresql-pgbash21-7.0'
series..... Kindof hokey name, though, IYKWIM.
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2000-05-20 18:06 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-05-17 07:28 pgbash-2.1 released SAKAIDA Masaaki <sakaida@psn.co.jp>
2000-05-17 13:29 ` Thomas Lockhart <lockhart@alumni.caltech.edu>
2000-05-18 00:45 ` SAKAIDA Masaaki <sakaida@psn.co.jp>
2000-05-18 05:10 ` Thomas Lockhart <lockhart@alumni.caltech.edu>
2000-05-18 15:08 ` Karel Zak <zakkr@zf.jcu.cz>
2000-05-20 18:06 ` Lamar Owen <lamar.owen@wgcr.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox