Re: postgres via shell scripts

Поиск
Список
Период
Сортировка
От Billy G. Allie
Тема Re: postgres via shell scripts
Дата
Msg-id 200010070037.e970btk23397@bajor.mug.org
обсуждение исходный текст
Ответ на postgres via shell scripts  (Mike Sears <msears@vianet.ca>)
Список pgsql-general
Mike Sears wrote:
> Is there away to access a postgres database using a shell script, like bash
> or korn?
>
> Mike
>

The solution I came up with to access a database (originally Sybase, the later
msql and PostgreSQL) from the shell (sh, ksh) and awk was to write a program
(called getsql) that accepted SQL statements from stdin and wrote the result
to stdout as delimited fields (the default was the bar [|] character).  I
would then create 2 named pipes and run getsql in the background reading from
one named pipe and writing to the other named pipe.  The program that needed
access (sh, ksh, awk, etc) would then write queries to the named pipe that
getsql was reading from and get the results from the named pipe getsql writes
to.

If you are interested, I can send you the source code for getsql, or if there
is enough interest, I can post the code to the list.
--
____       | Billy G. Allie    | Domain....: Bill.Allie@mug.org
|  /|      | 7436 Hartwell     | Compuserve: 76337,2061
|-/-|----- | Dearborn, MI 48126| MSN.......: B_G_Allie@email.msn.com
|/  |LLIE  | (313) 582-1540    |



Вложения

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

Предыдущее
От: "Efrain Caro"
Дата:
Сообщение: Delphi PostgreSQL Forum
Следующее
От: "Franz J Fortuny"
Дата:
Сообщение: Advise requested and suggestions welcome