mirror of https://github.com/tLDP/LDP
utility to pull wiki text from database into standard output
This commit is contained in:
parent
594014afc2
commit
773b0642e1
|
@ -0,0 +1,20 @@
|
|||
#! /usr/bin/perl
|
||||
|
||||
use Pg;
|
||||
|
||||
$dbmain = "ldp";
|
||||
@row;
|
||||
|
||||
# Read parameters
|
||||
$doc_id = $ARGV[0];
|
||||
|
||||
$conn=Pg::connectdb("dbname=$dbmain");
|
||||
die $conn->errorMessage unless PGRES_CONNECTION_OK eq $conn->status;
|
||||
|
||||
$result = $conn->exec("SELECT wiki FROM document_wiki WHERE doc_id = $doc_id ORDER BY revision DESC LIMIT 1, 0");
|
||||
die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus;
|
||||
@row = $result->fetchrow;
|
||||
$wiki = $row[0];
|
||||
$wiki =~ s/\s+$//;
|
||||
|
||||
print $wiki;
|
Loading…
Reference in New Issue