-- Connection, bon ça ça marche.
My_Password := Hidden_Get_Line;
Initialize(This => MySQL_Object);
User(MySQL_Object, "root" );
Password(MySQL_Object, My_Password.all);
Connect (This => MySQL_Object,
Server => "localhost",
DB => Db_name);
-- après je scinde une requête qui pourait se faire en une mais ça marche pas non plus.
-- alors, du coup je galère pour récupéré le résultat de la première requête.
declare
Id : Query_Id := Null_Query_Id;
Query_User_Id : Query_Id := Null_Query_Id;
User_Id : Integer;
Field_Name : String_Access;
begin
Query_User_Id := Query(MySQL_Object,
"select User_Id from Users where Username = """ & Logname & """;" );
if Query_User_Id /= Null_Query_Id then
Text_Io.Put_line("Not Null Query Id" );
if Get_Field_Length(MySQL_Object, Query_User_Id, "User_Id" ) /= 0 then
Text_Io.Put_line("Get User_Id" );
Field_Name := new String ' (Get_Field_Name(MySQL_Object, Query_User_Id, 1));
Text_Io.Put_line("Field name := " & Field_Name.all);
Text_Io.Put_line("User_Id done" );
-- Ca fonctionne jusqu'ici.
--Next(MySQL_Object, Query_User_Id);
User_Id := Integer_Field(MySQL_Object, Query_User_Id, Field_Name.all); -- ici ça plante.
Id := Query(MySQL_Object, "select * from Woprs where User_Id = " &
Natural'Image(User_Id) & ";" );
if Id /= Null_Query_Id then
Exist := True;
Drop_Query(MySQL_Object, Id);
else
Exist := False;
end if;
end if;
Drop_Query(MySQL_Object, Query_User_Id);
else
Text_Io.Put_line("Null query_id" );
Exist := False;
end if;
end;