From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,67748e866d067110 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: SOCI-Ada: The Database Access Library for Ada Date: Fri, 08 Aug 2008 15:47:39 +0200 Message-ID: <6g313lFe18jnU1@mid.individual.net> References: <9fa4c3e0-86bc-4a7d-98fb-6be76cb8aa68@d1g2000hsg.googlegroups.com> <6g0hikFdkv5oU1@mid.individual.net> <21f1f8b4-8e25-4b3f-90fa-004595237c1a@e39g2000hsf.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: individual.net zZRr45thTh83GzJSYbt9fwRp6U+vKlP26uluOTLcb203R/W9o= Cancel-Lock: sha1:lzpdXvvHXH49D8W7kVS17wowqtQ= User-Agent: KNode/0.10.9 Xref: g2news1.google.com comp.lang.ada:1548 Date: 2008-08-08T15:47:39+02:00 List-Id: Maciej Sobczak wrote: > On 7 Sie, 17:10, "Alex R. Mosteo" wrote: > >> As for comments for improvement, after a quick read I would like to see one >> example on how to use pooled connections. > > You can find it in the test program that is included as part of the > package (the archive, not the Ada one :-) ). > I have decided not to include the connection pool example in the > "idioms" part, because connection pools are usually needed in bigger > contexts and the simple example would be artificial - whereas other > examples still make sense, even in such short forms. > > I will think about some reasonable example for connection pools. > Again, one is in the test program - it is the last test. > >> Another thing is that in C++ there's mimicking of embedded SQL using the >> "<<" operator. Can't this be to some extent emulated in Ada with some >> operator overloading? > > I think that the design of the library, including its syntax, needs to > reflect the general spirit of the community that is going to use it. > > For example, I find it quite easy to sell this: > > int count; > sql << "select count(*) from persons", into(count); > > to C++ programmers - for one thing, it looks like streams and indeed > streams can be involved to format parts of the query and in general > the whole statement looks "cool". > An important factor here is that there are lots of C++ libraries that > use operator overloading extensively (including the standard library!) > and that's why C++ programmers can accept this technique even on the > border of abuse. > Please see this page: > > http://soci.sourceforge.net/doc/rationale.html > > for the rationale of different syntax elements in C++. > > Contrary to the above, I think that Ada programmers would find such > syntax "a bit" overboard. > I have decided not to stress the audience with any operator > overloading and provide the "classical" interface that is in line with > the interfaces of other Ada libraries - in particular the standard > library. I see your reasoning, and I agree it's a good idea to adapt to the particular culture surrounding a language, albeit I'm not so sure what's a "valid" Ada way. For me, as long as there are no pointers around, it's kinda enough. Of course, one can have it in several ways ;) (obviously it requires more work). I personally don't mind some operator overloading in well-defined contexts, where there's no risk of confusion. Take a look for example at Gnat.Spitbol.Patterns, where "&", "*" and "**" are used to great effect: at first it was a bit surprising but then it is really comfortable. In your case it wouldn't feel wrong to me, because it's done for a very specific purpose. In any case we are now icing the cake; I guess that these kinds of high-level pieces can arrive at a later date if someone has the motivation to contribute them. If I were idle, for example, I'd like some controlled type for automatically scoped transactions, and a matrix view of results. I always end implementing something like that. I have a small project with only a few database queries that now are really ugly (because the library I'm using can't bind vars to values and thus there's a lot of string concatenation). It would be a good opportunity for me to clean it up and get a feel for SOCI; I'll tell you how it goes if I do it.