[postgis-devel] Issue 34 in postgis: .prj creation by pgsql2shp
codesite-noreply at google.com
codesite-noreply at google.com
Wed Dec 10 06:54:18 PST 2008
Comment #14 on issue 34 by mark.cav... at siriusit.co.uk: .prj creation by
pgsql2shp
http://code.google.com/p/postgis/issues/detail?id=34
According to the arguments, it writes it's output into an existing buffer
rather than
creating a new string and returning it. So you could do something like:
char *esc_schema;
int error;
esc_schema = malloc(2 * strlen(schema) + 1);
PQescapeStringConn(conn, esc_schema, schema, strlen(schema), &error);
...
... Perform SQL query
...
PQfree(esc_schema);
Then just refer to "esc_schema" in your snprintf() rather than schema.
Note: the
correct length for esc_schema is calculated as per the notes in the
PostgreSQL
documentation and so will not overflow. I would avoid using parameterised
queries for
this, as it's designed for caching query plans across multiple queries
rather than
just escaping strings.
HTH,
Mark.
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
More information about the postgis-devel
mailing list