Hi,
Perused the forum's related threads but none gave me a real answer (or one I could process..
)
got this query with a call to a Postgis function defined in a QString for later insertion in the prepare() :
QString WKT
= QString("st_geomfromtext('POINT(%1 %2)', 4326)").
arg(lon
).
arg(lat
);
QString WKT = QString("st_geomfromtext('POINT(%1 %2)', 4326)").arg(lon).arg(lat);
To copy to clipboard, switch view to plain text mode
and getting this in my server's log:
2012-04-01 18:44:31 UTC STATEMENT EXECUTE qpsqlpstmt_af ('2012-04-01 19:44:31', '123456789012345', 161, 513, 18, '2012-04-01 19:47:05', 1361, 'st_geomfromtext("POINT(-16.8516 32.64)'', 4326)')
2012-04-01 18:44:31 UTC STATEMENT EXECUTE qpsqlpstmt_af ('2012-04-01 19:44:31', '123456789012345', 161, 513, 18, '2012-04-01 19:47:05', 1361, 'st_geomfromtext("POINT(-16.8516 32.64)'', 4326)')
To copy to clipboard, switch view to plain text mode
fx st_geomfromtext failing because it needs single quotes...
single quotes are being replaced with double quotes... 
also tried:
QString WKT
= QString("st_geomfromtext(\'POINT(%1 %2)\', 4326)").
arg(lon
).
arg(lat
);
QString WKT = QString("st_geomfromtext(\'POINT(%1 %2)\', 4326)").arg(lon).arg(lat);
To copy to clipboard, switch view to plain text mode
no luck here either...
so what's the correct way of leaving those single quotes there?
Thx in advance! 
Added after 1 34 minutes:
ok... replying to self... 
since I was going no where with the previous method ... started to think "out of the box" eheheh
Solution:
in the query.prepare string:
simply call the desired function and then feed it its "single-quote-needed-parameters" like this:
QString WKT = QString("POINT(%1 %2)").arg(lon).arg(lat);
To copy to clipboard, switch view to plain text mode
query.prepare("BLAH BLAH BLAH... st_geomfromtext(:etadest, 4326))");
query.bindValue(":etadest", WKT);
query.prepare("BLAH BLAH BLAH... st_geomfromtext(:etadest, 4326))");
query.bindValue(":etadest", WKT);
To copy to clipboard, switch view to plain text mode
Hope this helps someone..
Bookmarks