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,c9d5fc258548b22a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx02.iad01.newshosting.com!newshosting.com!198.186.190.251.MISMATCH!transit4.readnews.com!news-out.readnews.com!postnews3.readnews.com!postbox2.readnews.com!not-for-mail Date: Wed, 02 Mar 2011 13:29:56 -0500 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.14) Gecko/20110221 Thunderbird/3.1.8 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <31c357bd-c8dc-4583-a454-86d9c579e5f4@m13g2000yqb.googlegroups.com> <05a3673e-fb97-449c-94ed-1139eb085c32@x1g2000yqb.googlegroups.com> <4d4c232a$0$28967$882e7ee2@usenet-news.net> <4D4D6506.50909@obry.net> <4d50095f$0$22393$882e7ee2@usenet-news.net> <4d6d56c4$0$11509$882e7ee2@usenet-news.net> <16u9ka51wbukr$.1fj2sb73j9rv6.dlg@40tude.net> <4d6d627b$0$11509$882e7ee2@usenet-news.net> <29c4lixc0ght$.14kkfz1kij135.dlg@40tude.net> <4d6d6afb$0$11509$882e7ee2@usenet-news.net> <1gz9984wwizn5.r619fw4z9o56.dlg@40tude.net> <4d6e5614$0$21954$882e7ee2@usenet-news.net> <4d6e64f5$0$21954$882e7ee2@usenet-news.net> <4d6e811b$0$21956$882e7ee2@usenet-news.net> <1bnko88u7cfiu$.1p6595qf6pjfn$.dlg@40tude.net> In-Reply-To: <1bnko88u7cfiu$.1p6595qf6pjfn$.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4d6e8ca5$0$17939$a8266bb1@postbox2.readnews.com> NNTP-Posting-Host: 198.186.190.52 X-Trace: 1299090597 postbox2.readnews.com 17939 198.186.190.52:44643 Xref: g2news2.google.com comp.lang.ada:18708 Date: 2011-03-02T13:29:56-05:00 List-Id: On 3/2/2011 1:04 PM, Dmitry A. Kazakov wrote: >> On 3/2/2011 12:21 PM, Dmitry A. Kazakov wrote: >>> Of course it does. No Ada programmer would add anything to an actual >>> parameter. >> The GNATColl code did so. > Because they interfaced a PostreSQL client. But that client didn't want the quotes. The GNATColl Ada programmers made a mistake. > Hello world! is not a string. Correct, neither in Ada nor in SQL. It must be quoted to become one. >> SQL is a type of programming language, and SQL statements that >> involve literal strings must have them be quoted. > > Literal strings need not be quoted. Quotes is an integral part of the > literal. The resulting string does not have quotes. Programmers construct pieces of SQL code, interpolating strings into those constructs so that those interpolated strings become string literals in the SQL code. In that created SQL code, the interpolated strings must be quoted. > When an Ada subprogram is called no quotes are required as in your example > with Put_Line. A string object is passed as-is be it a literal or not. If a programmer were to create the line of Ada dynamically and interpolate a string into the result, he would be faced with exactly the same problem. You seem to have a major difficulty in understanding that programmers are creating code dynamically. > But > interfacing SQL requires quotes because it requires a conversion of a > native string object to its would be equivalent textual representation in > the SQL syntax. That is false, because SQL interfaces also provide ways to pass parameters separately, not through textual interpolation. It was in this approach that GNATColl had an error, erroneously converting to the textual representation when it was not required. > This is a source of errors as expected, because it is > untyped. There is no way the program can be checked for type errors. Either > random string represent a legal SQL statement of the semantics nobody can > tell, or not. That is to happen at run time. This is again false. A dynamic SQL builder in Ada could be created that represented SQL statements using hierarchical Ada types and objects, and produced the final SQL string representation upon execution. In fact, GNATColl uses this approach: It also allows prepared queries with parameters, and it was in processing those parameters that the programmers simply screwed up and added quotes where they shouldn't have, because they got mixed up between generating the literal code and passing the parameters.