Date: Fri, 14 Jan 2022 21:41:18 +0100
Hi,
On Wed, Jan 12, 2022 at 9:23 PM Matus Chochlik via SG7 <sg7_at_[hidden]>
wrote:
>
>
> On Wed, Jan 12, 2022 at 7:47 PM Jonathan O'Connor via SG7 <
> sg7_at_[hidden]> wrote:
>
>> Matus,
>> As all the interesting work is in creating the select statement, it might
>> be easier and quicker to just generate the string! Way easier to write
>> tests too!
>>
>> From what I can see from the ruby world, people use the name of the
>> class, function or parameter to generate strings and code. I would guess
>> the tricky one is getting the name of the parameter, rather than an
>> argument (I had to look up the difference. Parameter name is given in the
>> declaration and argument name is given in the definition.)
>>
>> The examples you've shown so far seem to be writing a reflecting function
>> thatreads, writes or calls members of a struct. My table proxy example
>> would require you to generate a class and define member functions.Will that
>> be possible with your code? I have to read more of the existing SG7 papers.
>>
>
> My first try would be to use something similar as the stub class here:
>
> https://github.com/matus-chochlik/mirror/blob/2ee8247437b6cf5fe9f0e812196dbd9921be9262/example/mirror/fake_rpc.cpp#L135
>
> but instead of the serialized RPC request to generate the SQL. For the
> moment some of the repetitive stuff (=reflecting the function call
> expression and passing on the argument) in the function implementation is
> required.
> I'll play with this tomorrow.
>
> So a trivial implementation (no big error checking, etc.) is here:
https://github.com/matus-chochlik/mirror/blob/develop/example/mirror/sql_query_generator.cpp#L80
I had to find and fix some bugs in the compiler, so it took longer than
expected..
--Matus
On Wed, Jan 12, 2022 at 9:23 PM Matus Chochlik via SG7 <sg7_at_[hidden]>
wrote:
>
>
> On Wed, Jan 12, 2022 at 7:47 PM Jonathan O'Connor via SG7 <
> sg7_at_[hidden]> wrote:
>
>> Matus,
>> As all the interesting work is in creating the select statement, it might
>> be easier and quicker to just generate the string! Way easier to write
>> tests too!
>>
>> From what I can see from the ruby world, people use the name of the
>> class, function or parameter to generate strings and code. I would guess
>> the tricky one is getting the name of the parameter, rather than an
>> argument (I had to look up the difference. Parameter name is given in the
>> declaration and argument name is given in the definition.)
>>
>> The examples you've shown so far seem to be writing a reflecting function
>> thatreads, writes or calls members of a struct. My table proxy example
>> would require you to generate a class and define member functions.Will that
>> be possible with your code? I have to read more of the existing SG7 papers.
>>
>
> My first try would be to use something similar as the stub class here:
>
> https://github.com/matus-chochlik/mirror/blob/2ee8247437b6cf5fe9f0e812196dbd9921be9262/example/mirror/fake_rpc.cpp#L135
>
> but instead of the serialized RPC request to generate the SQL. For the
> moment some of the repetitive stuff (=reflecting the function call
> expression and passing on the argument) in the function implementation is
> required.
> I'll play with this tomorrow.
>
> So a trivial implementation (no big error checking, etc.) is here:
https://github.com/matus-chochlik/mirror/blob/develop/example/mirror/sql_query_generator.cpp#L80
I had to find and fix some bugs in the compiler, so it took longer than
expected..
--Matus
Received on 2022-01-14 20:41:30