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,9986f50b2446f516,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!x27g2000yqb.googlegroups.com!not-for-mail From: tonyg Newsgroups: comp.lang.ada Subject: gnade odbc and join tables Date: Mon, 5 Jul 2010 10:59:31 -0700 (PDT) Organization: http://groups.google.com Message-ID: <1265b06d-298d-4d1d-ae74-61262605262f@x27g2000yqb.googlegroups.com> NNTP-Posting-Host: 89.240.135.62 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1278352772 21332 127.0.0.1 (5 Jul 2010 17:59:32 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 5 Jul 2010 17:59:32 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x27g2000yqb.googlegroups.com; posting-host=89.240.135.62; posting-account=28F2IwkAAACL1Z5nRC-dE7zuvWdbWC7P User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.2.6) Gecko/20100628 Ubuntu/10.04 (lucid) Firefox/3.6.6,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:13163 Date: 2010-07-05T10:59:31-07:00 List-Id: I'm adapting the odbc demo in gnade to learn more about it. I want to be able to join tables and do a select according to the query string included in the code fragment. I 've modified the SQL prepare statement and here it is Len : aliased SQLINTEGER := 0; -- ignored for SQL_C_SLONG, if not negative Len_Macid : aliased SQLINTEGER; Macid : aliased String := 16 * '.'; Planid : aliased SQLINTEGER; Len_Planid : aliased SQLINTEGER; query_string : String := "Select heater.macid, room.planid from heater" & "join room on heater.roomid = room.roomid order by room.planid"; begin SQLAllocHandle (SQL_HANDLE_STMT, ConnectionHandle, StatementHandle); SQLPrepare (StatementHandle, "SELECT " & QuoteIdentifier ("HEATER.MACID") & ", " & QuoteIdentifier ("ROOM.PLANID") & ", " & " FROM " & QuoteIdentifier ("HEATER") & " JOIN " & QuoteIdentifier("ROOM") & " " & "WHERE " & QuoteIdentifier ("HEATER.ROOMID") & " = " & QuoteIdentifier ("ROOM.ROOMID") & "ORDER BY " & QuoteIdentifier ("ROOM.PLANID") ); This is returning the following error when running raised GNU.DB.SQLCLI.SYNTAX_ERROR : [Proc=SQLBindCol][Server=x.x.x.x] [State=42000][MySQL][ODBC 3.51 Driver][mysqld-5.0.77]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for th (ip address is x'ed out !) What am I doing wrong here - can anyone see?