Search Postgresql Archives

psql batch file question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

 

 


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux