comp.lang.ada
 help / color / mirror / Atom feed
* gnade odbc and join tables
@ 2010-07-05 17:59 tonyg
  2010-07-05 20:13 ` Georg Bauhaus
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: tonyg @ 2010-07-05 17:59 UTC (permalink / raw)



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?



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-07-06  6:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-05 17:59 gnade odbc and join tables tonyg
2010-07-05 20:13 ` Georg Bauhaus
2010-07-05 20:35 ` Ludovic Brenta
2010-07-06  6:30   ` tonyg
2010-07-06  6:09 ` Stephen Leake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox