psql batch file question

Поиск
Список
Период
Сортировка
От Matt Doughty
Тема psql batch file question
Дата
Msg-id 8A38B86D9187B34FA18766E261AB3AEA0D243F@sageograma.GEO-I.local
обсуждение исходный текст
Ответы Re: psql batch file question
Список 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

www.geograma.com

 

 

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: top posting (was: Hijack!)
Следующее
От: "Mitchell Vincent"
Дата:
Сообщение: Re: The leanest, meanest Windows installer possible