On 01/17/2016 06:35 PM, Alexis King wrote:
The DB docs for SQL type conversions[1] note that not all Postgres types
are supported by Racket, and it recommends using a cast to work around
this. It even uses the inet type as an example right at the start of the
page. However, I want to store an
How about: (query-exec conn (format "INSERT INTO some_table (ip) VALUES
(inet '~a')" client-ip))
On Sun, Jan 17, 2016 at 6:35 PM, Alexis King wrote:
> The DB docs for SQL type conversions[1] note that not all Postgres types
> are supported by Racket, and it recommends
You can cast first to a supported type:
(query-exec conn "INSERT INTO some_table (ip) VALUES (inet ($1 ::text))"
client-ip)
On 2016-01-17 7:35 PM, Alexis King wrote:
I would like to avoid interpolating into a query if at all possible,
given that this string is not something I control. I
The DB docs for SQL type conversions[1] note that not all Postgres types
are supported by Racket, and it recommends using a cast to work around
this. It even uses the inet type as an example right at the start of the
page. However, I want to store an inet value in my database, not query
an inet
Ah, that is a better idea.
> On Jan 17, 2016, at 7:39 PM, Marc Burns wrote:
>
> You can cast first to a supported type:
>
> (query-exec conn "INSERT INTO some_table (ip) VALUES (inet ($1 ::text))"
> client-ip)
>
>> On 2016-01-17 7:35 PM, Alexis King wrote:
>> I would
I sympathize, but using a prepared statement parameter requires support for the
type of the parameter. If the library doesn't support it, you'll need to use
strings (and escape them appropriately, though it looks like the library
doesn't provide a string-escaping function), or else patch the
Perfect, that works great, thank you! It looks like the precedence works
out such that I could do $1::text::inet and have it work properly, which
is clean enough for my needs.
> On Jan 17, 2016, at 16:39, Marc Burns wrote:
>
> You can cast first to a supported type:
>
>
I would like to avoid interpolating into a query if at all possible,
given that this string is not something I control. I could be very
careful about validating or sanitizing it, but this is a pretty textbook
use case for parameterized queries.
> On Jan 17, 2016, at 16:19, Jon Zeppieri
8 matches
Mail list logo