text
stringlengths
0
234
Response : Query := CreateQuery ("1+1");
V : String_Vectors.Vector;
begin
V := Response.Results;
Assert (Condition => V (0) = "2", Message => "Query test");
Response.Close;
Function Definition: procedure Query_Bind is
Function Body: result : Boolean;
begin
result := Connect ("localhost", 1_984);
Assert (Condition => result = True, Message => "Connect test");
result := Authenticate ("admin", "admin");
Assert (Condition => result = True, Message => "Auth test");
declare
Response : Query :=
CreateQuery
("declare variable $name external; for $i in 1 to 1 return element { $name } { $i }");
begin
Response.Bind ("name", "number", "");
declare
Res : String := Response.Execute;
begin
Assert
(Condition => Res = "<number>1</number>",
Message => "Query bind");
Function Definition: procedure QueryExample is
Function Body: V: String_Vectors.Vector;
begin
if (Connect ("localhost", 1_984) = False) then
Ada.Text_IO.Put_Line ("Connect failed.");
return;
else
if (Authenticate ("admin", "admin") = False) then
Ada.Text_IO.Put_Line ("Authenticate failed.");
Close;
return;
end if;
end if;
declare
Response : Query := CreateQuery ("for $i in 1 to 10 return <xml>Text { $i }</xml>");
begin
V := Response.Results;
for E of V loop
Put_Line (E);
end loop;
Response.Close;
Function Definition: procedure ExampleAdd is
Function Body: begin
if (Connect ("localhost", 1_984) = False) then
Ada.Text_IO.Put_Line ("Connect failed.");
return;
else
if (Authenticate ("admin", "admin") = False) then
Ada.Text_IO.Put_Line ("Authenticate failed.");
Close;
return;
end if;
end if;
declare
Response : String := Execute ("create db database");
begin
Ada.Text_IO.Put_Line (Response);
Function Definition: procedure Example is
Function Body: begin
if (Connect ("localhost", 1_984) = False) then
Ada.Text_IO.Put_Line ("Connect failed.");
return;
else
if (Authenticate ("admin", "admin") = False) then
Ada.Text_IO.Put_Line ("Authenticate failed.");
Close;
return;
end if;
end if;
declare
Response : String := Execute ("xquery 1 to 10");
begin
Ada.Text_IO.Put_Line (Response);
Function Definition: procedure QueryExample is
Function Body: begin