comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: (GNADE) Access attribute not allowed in generic body
Date: Thu, 15 Aug 2013 09:53:37 +0200
Date: 2013-08-15T09:53:37+02:00	[thread overview]
Message-ID: <c2kkhpusa6e7.1py6twokcaei3$.dlg@40tude.net> (raw)
In-Reply-To: 86395c3d-e0e2-41f1-8286-08a64125fd2e@googlegroups.com

On Thu, 15 Aug 2013 00:27:58 -0700 (PDT), Dwiki wrote:

> im trying to compile app using gnade (1.5.3a) in windows, but it show error message 
[...]
> any clue?

Yes, I remember these errors caused by Ada 2005 vs. 95 incompatibilities.

I stopped using GNADE long ago, but I still have the fixes I made in GNADE
2.0. I moved Get and Set to private part of the package and used
'Unrestricted_Access in Register. E.g.:
-----------------------------
with GNU.DB.SQLCLI.Generic_Attr.String_Attribute;
pragma Elaborate_All (GNU.DB.SQLCLI.Generic_Attr.String_Attribute);

generic
package GNU.DB.SQLCLI.Dispatch.A_String is

   package Derived is new Attr.String_Attribute;
   subtype Info is Derived.Attribute_Value_Pair_String;

   procedure Register (Index : in Attr.T);
   pragma Inline_Always (Register);

private
   function Get (Handle    : Ctx;
                 Attribute : Attr.T;
                 MaxLength : SQLSMALLINT := 0;
                 Data      : Attr.Aux;
                 ErrorCode : access SQLRETURN)
                return Attr.Attribute_Value_Pair'Class;
   procedure Set (Handle    : in  Ctx;
                  AV_Pair   : in  Attr.Attribute_Value_Pair'Class;
                  Data      : in  Attr.Aux;
                  ErrorCode : out SQLRETURN);

end GNU.DB.SQLCLI.Dispatch.A_String;
--------------------------------
package body GNU.DB.SQLCLI.Dispatch.A_String is

   function Get (Handle    : Ctx;
                 Attribute : Attr.T;
                 MaxLength : SQLSMALLINT := 0;
                 Data      : Attr.Aux;
                 ErrorCode : access SQLRETURN)
                return Attr.Attribute_Value_Pair'Class is
   begin
      return Info (Derived.GetAttr (Handle,
                                    Attribute,
                                    Data,
                                    MaxLength,
                                    ErrorCode));
   end Get;

   procedure Set (Handle    : in  Ctx;
                  AV_Pair   : in  Attr.Attribute_Value_Pair'Class;
                  Data      : in  Attr.Aux;
                  ErrorCode : out SQLRETURN) is
   begin
      if not (AV_Pair in Info'Class) then
         Raise_SQL_Error
           (ProcedureName => "SetAttr",
            ErrorMessage  => "Attribute value is not a String",
            RC            => SQL_ADA95_TYPE_ERROR);
      end if;
      Derived.SetAttr (Handle, Info (AV_Pair), Data, ErrorCode);
   end Set;

   procedure Register (Index : in Attr.T) is
   begin
      Get_Dispatch_Array (Index) := Get'Unrestricted_Access;
      Set_Dispatch_Array (Index) := Set'Unrestricted_Access;
   end Register;

end GNU.DB.SQLCLI.Dispatch.A_String;
-----------------------------------
I cannot tell if that helps, because, as I said I don't use it anymore.

P.S.

1. GNADE seems to be not maintained.

2. GNADE ODBC bindings will certainly not work on any natively 64-bit
platform because MS changed ODBC API. If you want ODBC bindings you can try
these:

http://www.dmitry-kazakov.de/ada/components.htm#ODBC_Bindings

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  parent reply	other threads:[~2013-08-15  7:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15  7:27 (GNADE) Access attribute not allowed in generic body Dwiki
2013-08-15  7:37 ` Dwiki
2013-08-15  7:53 ` Dmitry A. Kazakov [this message]
2013-08-15  8:17   ` Dwiki
2013-08-16 16:46     ` Stephen Leake
2013-08-18 13:40       ` Dwiki
2013-08-15  8:37   ` egilhh
2013-08-16 16:44   ` Stephen Leake
2013-08-15 13:42 ` Shark8
2013-08-15 15:10   ` Adam Beneschan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox