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,5d2a76ae813fad83,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!k39g2000yqb.googlegroups.com!not-for-mail From: tonyg Newsgroups: comp.lang.ada Subject: integer binding and gnade odbc Date: Tue, 6 Jul 2010 00:48:31 -0700 (PDT) Organization: http://groups.google.com Message-ID: <9e7efe1c-1823-49ff-be26-b39bced21e8a@k39g2000yqb.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 1278402511 1740 127.0.0.1 (6 Jul 2010 07:48:31 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 6 Jul 2010 07:48:31 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k39g2000yqb.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:13186 Date: 2010-07-06T00:48:31-07:00 List-Id: When I run this code type Planid_Type is new SQLINTEGER; type Planid_Ptr is access all Planid_Type; package Planid_Binding is new GNU.DB.SQLCLI.IntegerBinding (Planid_Type); package PB renames Planid_Binding; StatementHandle : SQLHSTMT; Len_Macid : aliased SQLINTEGER; Macid : aliased String := 16 * '.'; Planid : aliased Planid_Type; 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") & "." & QuoteIdentifier ("macid") & ", " & QuoteIdentifier ("room") & "." & QuoteIdentifier ("planid") & " FROM " & QuoteIdentifier ("heater") & " INNER JOIN " & QuoteIdentifier("room") & " ON " & QuoteIdentifier ("heater") & "." & QuoteIdentifier ("roomid") & " = " & QuoteIdentifier ("room") & "." & QuoteIdentifier ("roomid") & "ORDER BY " & QuoteIdentifier ("room") & "." & QuoteIdentifier ("planid") ); SQLBindCol (StatementHandle, 1, Macid'Access, Len_Macid'Access); PB.SQLBindCol ( StatementHandle, 2, Planid'Access, Len_Planid'Access); SQLExecute (StatementHandle); begin loop SQLFetch (StatementHandle); SQLFixNTS (Macid, Len_Macid); Put (Macid); Put (", "); Put (Planid_Type'image(Planid)); New_Line; end loop; exception when No_Data => -- normal loop exit null; end; The code compiles and it returns the macid parameter with the correct string , however the value I get for planid is 0 which is incorrect. I took Stephe's Advice and I ran it through the mysql query browser and got the correct result ( which is 1) . Am I binding my integer column correctly ? (I suspect not)