Interpolated strings and SQL

Paolo Invernizzi paolo.invernizzi at gmail.com
Tue Jan 9 23:42:36 UTC 2024


On Tuesday, 9 January 2024 at 23:21:34 UTC, Walter Bright wrote:
> P.S. Thank you for your well constructed arguments.
>
> On 1/9/2024 1:35 PM, Nickolay Bukreyev wrote:
>> A valid point, thanks. Could you test if that fixes the issue?
>
> Yes, that works.
>
>> We are probably talking about different things. Adam’s 
>> implementation constructs a format string at compile time 
>> thanks to `enum` storage class [in line 
>> 36](https://github.com/adamdruppe/interpolation-examples/blob/a8a5d4d4ee37ee9ae3942c4f4e8489011c3c4673/lib/sql.d#L36).
>
> Yes, you're right.
>
>> Constructing it at compile time is essential so that we can 
>> validate the generated SQL and abort compilation, as Paolo 
>> [demonstrated](https://forum.dlang.org/post/qbtbyxcglwijjbeygtvi@forum.dlang.org).
>
> That only checks one aspect of correctness - nested string 
> interpolations.

No.

If you look at the errors raised during the compilation of our 
codebase, we are checking FAR MORE, for example the second error 
is related to wrong missing grant condition on a select.

I've included it as an example, just not syntax, table names, 
semantic or so, but also permissions, at compile time.

And that's a concrete codebase, used in production, not 
speculations.

/P


More information about the Digitalmars-d mailing list