Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Capturing warnings from DBD:PG

by Pope-O-Matik (Pilgrim)
on Nov 16, 2015 at 14:03 UTC ( [id://1147800]=note: print w/replies, xml ) Need Help??


in reply to Capturing warnings from DBD:PG

$dbh->quote($post_id) . "," .

A side point, if you don't mind: The code uses dynamic SQL. Instead of building the statement on the fly, please use placeholders instead. That is, something like:

my $cmd = "insert into latlong (post_id,some_text,geom) VALUES (?, ?, +?);" my $query_handle = $dbh->prepare($cmd); $query_handle->execute($post_id, $some_text, "ST_GeomFromText('POINT($ +LongDEC $LatDEC)', 4326)");

Using placeholders tends to be safer, more clear, and does not (usually) require special quoting.

Replies are listed 'Best First'.
Re^2: Capturing warnings from DBD:PG
by HeadScratcher (Novice) on Nov 26, 2015 at 10:31 UTC

    Yes I know however in the past I have had trouble with creating sql cmds that involve geometry entries using placeholders It is thought due to escaping internal quotes this method works for this kind of SQL. For all other SQL commands I use placeholders

      Hmm... I guess that could be a problem. But, it's still worthwhile to use placeholders. Better to escape characters than to escape security.

      A function may do you well though. A little longer just once, and more secure in every script.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1147800]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found