From: | "Matt Doughty" <matt(dot)doughty(at)geograma(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | psql batch file question |
Date: | 2007-12-11 16:50:14 |
Message-ID: | 8A38B86D9187B34FA18766E261AB3AEA0D243F@sageograma.GEO-I.local |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi List,
I'm trying to write a batch file that executes a query in PostgreSQL.
Depending on the output of the query, the batch file does one of two
things, jumps to a line that has a command to export a table from
PostgreSQL, or calls another batch file, which copies some files.
What proving difficult is how to handle the output of the query. Should
I declare the output as a variable and somehow use that? Currently, the
output is:
Expanded display is on.
-[ RECORD 1 ]------
ta_id_vacia | DATA
I'd like to be able to use 'DATA' as a variable to call one command or
the other.
Has anybody got any ideas?
Thanks!
Matt
PS. Below I've copied the current state of the bat.
rem %1 database - %2 scheme
echo. IF \x \\select count(*) from function01('%2', '[table]') | psql %1
[user_name]==DATA goto data
echo.
:copy
echo. call copy_bat.bat [table]
:data
echo. pgsql2shp.exe -h localhost -u [user_name] -f [dbase_name]
"[scheme]".[table] querystring
:end
Matt Doughty
GEOGRAMA S.L.
Tel.: +34 945 13 13 72 652 77 14 15
Fax: +34 945 23 03 40
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Hart | 2007-12-11 16:54:12 | Re: top posting |
Previous Message | Andrew Sullivan | 2007-12-11 16:49:54 | top posting (was: Hijack!) |