[nem-en] SQL macros (dataSqlClient.n)
Kamil Skalski
kamil.skalski at gmail.com
Wed Oct 18 11:37:05 CEST 2006
Cool, this is a nice work. Did it actually work for you? I need to
check myself, but last time I tried to migrate the macros in similar
way to Sqlite it crashed (it was transactions or maybe fetching DB
schema).
I'm sure that we can use strings for generating SqliteConnection /
SqlClient / ... usage inside code, like:
def conn_class = Macros.NewName ("SqliteConnection");
<[ def conn = $(conn_class : name) ($(conn_string : string)); ]>
there is additional problem that we need to use proper namespaces, so
the classes should be fully qualified.
This way all the code generation could be hopefully common.
And for the compile-time execution I cannot see other choices than
using reflection to instantiate provider specific objects and having
the customized implementation of stuff, where providers differ between
each other in some helper classes. Making this provider-independent
seems very hard and not worth the effort though.
On 10/18/06, Ildar Mulyukov <ildar at users.sourceforge.net> wrote:
> On 18.10.2006 12:47:36, Kamil Skalski wrote:
> > Probably it is possible to get some more common code out of Npgsql
> > and SqlClient macros, but there will always be some provider
> > specific code, for example mapping of SQL types to .NET types, which
> > is needed during parameters assignment generation and converting
> > returned values. Also, macros must actually run the provider to
> > check the query.
> >
> > Probably the best way to see the opportunities and problems in
> > refactoring this code is trying to write macros for some other
> > provider. :)
>
> Hi, Kamil,
> it was nice to receive an answer so soon. Here comes a "1st approach
> patch" for Sqlite backend. You seem to 100% right. Is it possible to
> parametrize macros in some way? Or, probably, it is not needed at all.
> Then there are two ways to support backends:
> 1. make SqliteConnection() SqliteCommand() and some others from the
> ConfigureConnection macro (in a syntax tree) (weird)
> 2. make a comprehensive collection of backends inside the
> dataSqlClient.n
> What do you think?
> Regards, Ildar.
> --
> Ildar Mulyukov,
> free SW designer/programmer
> ================================================
> email: ildar at users.sourceforge.net
> projects: http://os-development.sourceforge.net/
> home: http://tuganger.narod.ru/
> ALT Linux Sisyphus
> ================================================
>
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>
>
>
>
--
Kamil Skalski
http://nazgul.omega.pl
More information about the devel-en
mailing list