[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Awful ($db ...)
From: |
Mario Domenech Goulart |
Subject: |
Re: [Chicken-users] Awful ($db ...) |
Date: |
Sun, 07 Oct 2018 17:39:21 +0200 |
Hi,
On Sun, 7 Oct 2018 13:20:29 +0200 Peter Bex <address@hidden> wrote:
> On Sun, Oct 07, 2018 at 09:08:48PM +1000, David Ireland wrote:
>> Hi,
>>
>> I'm using the database access in Awful and I'm having the troubles
>> recreating an example in the docs. After setting up a dummy postgres
>> database I tried this example:
>>
>> ($db "insert into foo (bar, baz) values (?, ?)" values: '("bar-val"
>> "baz-val"))
>>
>> Which produced this error:
>>
>> <eval> ($db "insert into foo (bar, baz) values (?, ?)" values:
>> (quote ("bar-val" "baz-val"))) <--
>>
>> Error: (get-last-result) ERROR: syntax error at or near ","
>> LINE 1: insert into foo (bar, baz) values (?, ?)
>
> I don't know if Awful does any processing of the SQL string, but if it
> does not, you will need to use the Postgres-native method of passing
> parameterized values, which uses $1, $2 etc placeholders to refer to
> the positional arguments.
Indeed, awful doesn't do anything to the SQL string. For Postgres, you
have to use Postgres' syntax for placeholders.
All the best.
Mario
--
http://parenteses.org/mario