Postgres and other database interfaces
rikki cattermole
rikki at cattermole.co.nz
Sun Feb 25 12:12:58 UTC 2018
On 26/02/2018 12:46 AM, Denis F wrote:
> On Sunday, 25 February 2018 at 09:23:18 UTC, rikki cattermole wrote:
>
>>>> It's the same concept as the SQL (and other) Standards.
>>>
>>> Ok, I propose to be consistent and ask for compliance with the
>>> Standard from the RDBMSes. For example, arguments substitution:
>>>
>>> MySQL uses the '?'
>>> PostgreSQL uses $1
>>> SQLite accepts both
>>> Oracle uses a :name
>>>
>>> (Really, it is very important to come to an agreement here because,
>>> for sure, the next obvious step is writing an ORM generator on top of
>>> the idea what you are proposing.)
>>
>> On IRC earlier today we discussed database libs a bit, we agreed that
>> both "?" and "@name" needed to be supported. No other suggestions came
>> up. We don't really need a third or fourth form I think.
>
> ...And you are planned to give up "$1" support in favor of '?' and ":name"?
>
> But it is impossible to convert text :names or '?' into Postgres's "$1":
> Postgres isn't knows fields names at start of a query processing and you
> can't replace '?' to "$<num>" by simple 'replace' call - it will need
> full syntax parsing of Posgres SQL query because queries can contain
> EXECUTE statement (whose purpose is executing dynamic commands).
Let's not go inventing a solution here, what does JDBC and ADO.net do?
More information about the Digitalmars-d
mailing list