[std.database] at compile time

Jacob Carlborg doob at me.com
Fri Oct 14 12:10:29 PDT 2011


On 2011-10-14 15:26, Andrei Alexandrescu wrote:
> On 10/14/11 6:08 AM, Jacob Carlborg wrote:
>> On 2011-10-14 12:19, foobar wrote:
>>> Has anyone looked at Nemerle's design for this?
>>> They have an SQL macro which allows to write SQL such as:
>>>
>>> var employName = "FooBar"
>>> SQL (DBconn, "select * from employees where name = $employName");
>>>
>>> what that supposed to do is bind the variable(s) and it also validates
>>> the sql query with the database. This is all done at compile-time.
>>>
>>> My understanding is that D's compile-time features are powerful enough
>>> to implement this.
>>
>> You cannot connect to a database in D at compile time. You could some
>> form of validation and escape the query without connecting to the
>> database.
>
> A little SQL interpreter can be written that figures out e.g. the names
> of the columns involved.
>
> Andrei

But you still won't be able to verify the columns to the actual database 
scheme?

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list