comp.lang.ada
 help / color / mirror / Atom feed
* Prepared_Statement :(
@ 2018-11-24 10:45 eduardsapotski
  2018-11-24 10:48 ` eduardsapotski
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: eduardsapotski @ 2018-11-24 10:45 UTC (permalink / raw)


Trying insert data into PostgreSql:

   function Insert_Trade(Trade : Trade_Type) return Boolean is 
      
      Conn   : Database_Connection := Build_Database_Connection;
      PS     : Prepared_Statement  := Prepare(Query => "INSERT INTO exmo.trades(trade_id, pair, type, price, quantity, amount, date) VALUES (?, ?, ?, ?, ?, ?, ?)");             
      Params : SQL_Parameters(1..7);
      FC     : Forward_Cursor;
      
      Result : Boolean := False;
         
   begin

      Params(1) := "+"(Trade.Trade_ID);
      Params(2) := "+"(Trade.Pair);
      Params(3) := "+"(Trade.Direction);
      Params(4) := "+"(Trade.Price'Img);
      Params(5) := "+"(Trade.Quantity'Img);
      Params(6) := "+"(Trade.Amount'Img);
      Params(7) := "+"(Trade.Date);
    
      Execute (Conn, PS, Params);
        
      Commit_Or_Rollback(Conn);
      
      Put_Line(Conn.Last_Error_Message);
      
      return Result;
      
   end;

Result:

ERROR:  syntax error at or near ","
LINE 1: ...ir, type, price, quantity, amount, date) VALUES (?, ?, ?, ?,...
                                                             ^

What's wrong? :( 
Can anyone have a working example?


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

end of thread, other threads:[~2018-11-28  5:04 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-24 10:45 Prepared_Statement :( eduardsapotski
2018-11-24 10:48 ` eduardsapotski
2018-11-24 11:05 ` Dmitry A. Kazakov
2018-11-24 11:20   ` eduardsapotski
2018-11-24 17:56     ` briot.emmanuel
2018-11-24 20:00       ` Simon Wright
2018-11-24 20:45       ` Dmitry A. Kazakov
2018-11-26  6:52       ` eduardsapotski
2018-11-27  0:27         ` Dennis Lee Bieber
2018-11-27  8:46           ` Dmitry A. Kazakov
2018-11-27  8:51             ` briot.emmanuel
2018-11-24 11:29 ` eduardsapotski
2018-11-27  9:58 ` eduardsapotski
2018-11-27 18:00   ` Dmitry A. Kazakov
2018-11-27 19:02     ` Björn Lundin
2018-11-28  5:04 ` eduardsapotski

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