Opened 7 years ago

Closed 7 years ago

#286 closed defect (fixed)

Dual MySQL queries don't work as expected

Reported by: ivan.levashev Owned by: SQL, MySQL
Priority: major Milestone: 0.5.0
Component: Matreshka - SQL Version: 0.4.0
Keywords: Cc:

Description

   --------------------------------
   -- Pooled_Database.Test_Alive --
   --------------------------------

   function Test_Alive (Object : not null access Pooled_Database_Object) return Boolean is
      Q : SQL.Queries.SQL_Query;
      Eight_Value : Holder;
   begin
      Q := Object.Query (From_UTF_8_String ("SELECT 3 + 5 AS eight"));
      Q.Execute;
      Eight_Value := Q.Value (1);
      Ada.Text_IO.Put_Line ("Test_Alive received" & Integer'Image (League.Holders.Integers.Element (Eight_Value)));
      return League.Holders.Integers.Element (Eight_Value) = 8;
   exception
      when E : SQL_Error | Constraint_Error =>
         Ada.Text_IO.Put_Line ("While Test_Alive... " & Ada.Exceptions.Exception_Name (E));
         return False;
   end Test_Alive;

outputs

Test_Alive received 0

I have yet no idea what is exactly going on here. I can't spot any obvious explanation.

Version: 0.4+ [r3727] vadim.godunko: Make Has_Detail abstract. Declare all kinds of faults as

Change History (6)

comment:1 by ivan.levashev, 7 years ago

Oh, I forgot this framework requires running Next on queries.

comment:2 by vadim.godunko, 7 years ago

In [3753]:

Rename internal subprogram from Is_Valid to Is_Object_Valid.

Refs #286.

comment:3 by vadim.godunko, 7 years ago

In [3755]:

Add automated test.

Refs #286.

comment:4 by vadim.godunko, 7 years ago

In [3756]:

Run automated test under valgrind to detect error.

Refs #286.

comment:5 by vadim.godunko, 7 years ago

In [3757]:

Add Is_Valid function for SQL_Query to be able to detect situation when
result value is obtained after query was prepared and executed, but not
retrieved by Next.

Refs #286.

comment:6 by vadim.godunko, 7 years ago

Milestone: 0.5.0
Resolution: fixed
Status: newclosed
Version: 0.4.0
Note: See TracTickets for help on using tickets.