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=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a24:42cb:: with SMTP id i194-v6mr12756815itb.2.1543058427897; Sat, 24 Nov 2018 03:20:27 -0800 (PST) X-Received: by 2002:aca:cc0f:: with SMTP id c15mr317520oig.3.1543058427758; Sat, 24 Nov 2018 03:20:27 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.166.216.MISMATCH!q69no171398itb.0!news-out.google.com!v141ni201ita.0!nntp.google.com!q69no171397itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 24 Nov 2018 03:20:27 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=151.249.135.130; posting-account=M7mWIgoAAACGA_Fxpu1-vAqIUttmwREB NNTP-Posting-Host: 151.249.135.130 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9468b0a5-19bd-4057-a0d8-f84ed0425188@googlegroups.com> Subject: Re: Prepared_Statement :( From: eduardsapotski@gmail.com Injection-Date: Sat, 24 Nov 2018 11:20:27 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:54882 Date: 2018-11-24T03:20:27-08:00 List-Id: =D1=81=D1=83=D0=B1=D0=B1=D0=BE=D1=82=D0=B0, 24 =D0=BD=D0=BE=D1=8F=D0=B1=D1= =80=D1=8F 2018 =D0=B3., 14:05:02 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE= =D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Dmitry A. Kazakov =D0=BD=D0=B0=D0=BF= =D0=B8=D1=81=D0=B0=D0=BB: > On 2018-11-24 11:45, eduardsapotski@gmail.com wrote: > > Trying insert data into PostgreSql: > >=20 > > function Insert_Trade(Trade : Trade_Type) return Boolean is > > =20 > > Conn : Database_Connection :=3D Build_Database_Connection; > > PS : Prepared_Statement :=3D Prepare(Query =3D> "INSERT INT= O exmo.trades(trade_id, pair, type, price, quantity, amount, date) VALUES (= ?, ?, ?, ?, ?, ?, ?)"); > > Params : SQL_Parameters(1..7); > > FC : Forward_Cursor; > > =20 > > Result : Boolean :=3D False; > > =20 > > begin > >=20 > > Params(1) :=3D "+"(Trade.Trade_ID); > > Params(2) :=3D "+"(Trade.Pair); > > Params(3) :=3D "+"(Trade.Direction); > > Params(4) :=3D "+"(Trade.Price'Img); > > Params(5) :=3D "+"(Trade.Quantity'Img); > > Params(6) :=3D "+"(Trade.Amount'Img); > > Params(7) :=3D "+"(Trade.Date); > > =20 > > Execute (Conn, PS, Params); > > =20 > > Commit_Or_Rollback(Conn); > > =20 > > Put_Line(Conn.Last_Error_Message); > > =20 > > return Result; > > =20 > > end; > >=20 > > Result: > >=20 > > ERROR: syntax error at or near "," > > LINE 1: ...ir, type, price, quantity, amount, date) VALUES (?, ?, ?, ?,= ... > > ^ > > What's wrong? :( >=20 > First. You don't say what library/binging/RDBMS client you are using,=20 > which version, what platform. That is certainly wrong. >=20 > Then, "date" is a reserved keyword in SQL, which has tons of. You could= =20 > start with qualifying all column names in the statement. >=20 > --=20 > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de with GNATCOLL.SQL_Impl; use GNATCOLL.SQL_Impl; with GNATCOLL.SQL.Exec; use GNATCOLL.SQL.Exec; with GNATCOLL.SQL.Postgres; use GNATCOLL.SQL; If I just write: Execute(Conn, "INSERT INTO exmo.trades(trade_id, pair, type, price, quantit= y, amount, date) VALUES (100500, 'pair', 'type', 1.0, 1.0, 1.0, 100500)"); Everything is working! I think the problem is in the parameters.