psql and HTML

Started by Johnson, Shaunnover 24 years ago3 messagesgeneral
Jump to latest
#1Johnson, Shaunn
SJohnson6@bcbsm.com

Howdy:

Running postgres 7 on Linux server (Mandrake 8) and
I'm trying to create a dynamic HTML page with the
list of tables I have.

If I do something like this in a perl script:

[snip]

$list = `/usr/bin/psql -H -d database -U user -c "\\d+"`;
print $list;

[/snip]

I get a page with the list of tables, no problem.
What I WANT to do is modify the HTML tags so that
each table in the list is highlighted and is an anchored
reference to someplace else. (That someplace else will
be another page giving the user some background info
on the table, the owner, the description, what it's
used for, etc).

I'm thinking that there is a way to modify it (or at least,
try to substitute what postgres creates, modify the HTML
part and input the list of tables again) via postgres,
but I'm not sure.

Has anyone done something like that? Are there any HTML
examples via postgres?

TIA

-X

#2Micah Yoder
yodermk@home.com
In reply to: Johnson, Shaunn (#1)
Re: psql and HTML

On Monday 29 October 2001 10:40 am, Johnson, Shaunn wrote:

try adding this line (or something similar depending on what your actual link
is):

$list = `/usr/bin/psql -H -d database -U user -c "\\d+"`;

$list =~ s/(op>\s+<td align=left>)([a-zA-Z0-9_]+)(?=<\/td)/$1<a
href="table.php?name=$2">$2<\/a>/g;

print $list;

--
Like to travel? http://TravTalk.org
Micah Yoder Internet Development http://yoderdev.com

#3Johnson, Shaunn
SJohnson6@bcbsm.com
In reply to: Micah Yoder (#2)
Re: psql and HTML

--thanks everyone:

--this is what we wound up using:

<excerpt from script>
$tables=`/usr/bin/psql -H -d bcn -U web -c "\\d+"`;
$tables =~ s!(top.+?<td align=left>)(\w+)!$1<a
href="$this?t=$2">$2</a>!gsi;
print $tables;
</excerpt>

--going to try yours, too.

--special thanks to sensei in TX for his suggestions (i'll post and
excerpt if i can get his permission)!

thanks again!

-X

-----Original Message-----
From: Micah Yoder
Sent: Monday, October 29, 2001 9:22 PM
To: Shaunn; pgsql-general@postgresql.org
Subject: Re: [GENERAL] psql and HTML

On Monday 29 October 2001 10:40 am, Johnson, Shaunn wrote:

try adding this line (or something similar depending on what your actual
link
is):

$list = `/usr/bin/psql -H -d database -U user -c "\\d+"`;

$list =~ s/(op>\s+<td align=left>)([a-zA-Z0-9_]+)(?=<\/td)/$1<a
href="table.php?name=$2">$2<\/a>/g;

print $list;

--
Like to travel? http://TravTalk.org
Micah Yoder Internet Development http://yoderdev.com