Re: [LIP] Cleaning of input prior to entering into a database

[email protected]
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <[email protected]>
Devdas Bhagat posted in linux-india-programmers:
> Why not use DBI->quote, or even better, placeholders? It isn't very hard
> to generate dynamic queries using Perl.

Ah well...

Background: I was trying to get syslog-ng logging into PostgreSQL. The
doc I was following had syslog-ng logging to a file with a template that
generated SQL from the log messages, and a perl script run from cron to
process this file (via a no-brainer psql -c - that is where I was trying
to plug in this sanitizer).

I threw this stuff out finally, and wrote a generic DBD::Pg script to
which syslog-ng would -pipe- log messages. Solves the original problem
(as you suggested), as well as the delay in logging due to running from
cron - not to mention the torture my DB would have had to undergo if I
ran psql -c INSERT for every single log message :)

Binand

-- 
Hanlon's Razor: Never attribute to malice that which can be adequately
explained by stupidity.
Bruce's Razor: Never attribute to stupidity that which can be adequately
explained by Microsoft funding.


-------------------------------------------------------
This SF.net email is sponsored by Demarc:
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/info/Sentarus/hamr30
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.