Anonymous user
Parameterized SQL statement: Difference between revisions
→{{header|Ada}}
(Creation of the Ada entry) |
|||
Line 11:
<lang Ada>
-- Version for sqlite
with
with
▲with GNATCOLL.SQL_Impl; use GNATCOLL, GNATCOLL.SQL_Impl;
procedure Prepared_Query is
DB_Descr
--sqlite does not support boolean fields
True_Str
(1 => (Parameter_Text, null),
2 => (Parameter_Integer, 0),
Line 34 ⟶ 31:
Setup_Database (DB_Descr, "rosetta.db", "", "", "", DBMS_Sqlite);
-- Allocate the connection
-- Initialize the connection
Reset_Connection (DB_Descr,
Prepare
("UPDATE players SET name = ?, score = ?, active = ? " &
" WHERE jerseyNum = ?"
declare
Name : aliased String := "Smith, Steve";
begin
Param := ("+" (Name'Access), "+" (42), "+" (True_Str'Access), "+" (99));
end;
Commit_Or_Rollback (Conn);
Free (DB_Descr);
end Prepared_Query;
</lang>
|