* integer binding and gnade odbc
@ 2010-07-06 7:48 tonyg
0 siblings, 0 replies; only message in thread
From: tonyg @ 2010-07-06 7:48 UTC (permalink / raw)
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)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-07-06 7:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-06 7:48 integer binding and gnade odbc tonyg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox