From: tonyg on 6 Jul 2010 03:48 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)
|
Pages: 1 Prev: Adagide: gnat1: invalid switch: 0 Next: odbc integer binding to column |