UPDATE Sector SET start = ST_GeomFromText( ' POINT ( -4.75513748886666 58.2553702983331 ) ', 4326 ), end = ST_GeomFromText( ' POINT ( -4.67682813534559 58.3335955352018 ) ', 4326 ) WHERE uid = 'NC33-341'
Placeholders are not designed for the purposes of building strings, they only occupy the places where separate scalar values can occur (which is to say, not inside an SQL string literal). Two options:
  1. Prepare a query like UPDATE Sector SET start = ST_GeomFromText( ?, ? ), end = ST_GeomFromText( ?, ? ) WHERE uid = ?. Use Perl string interpolation to generate strings  POINT ( -4.67682813534559 58.3335955352018 ) from your point objects: " POINT ( $st->{whatever} $st->{something_else} )" and supply those as placeholder values.
  2. Build the strings for ST_GeomFromText on the SQL side of the query: UPDATE Sector SET start = ST_GeomFromText( 'POINT(' || ? || ' ' || ? || ')', ? ), end = ST_GeomFromText( 'POINT(' || ? || ' ' || ? || ')' WHERE uid = ?. Supply individual parts of $st and $ed as placeholder parameters.
Both options look yucky. Is there another constructor for your POINT objects that accepts coordinates separately? Note that you can't use $st->sql in a placeholder because placeholders only work for individual scalar values, not arbitrary pieces of SQL code. Indeed, that would destroy the entire purpose of placeholders and make SQL injections possible.

In reply to Re: DBI placeholders for spatial data by Anonymous Monk
in thread DBI placeholders for spatial data by Bod

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.