شرح أوسلو خطأ "M2037: خطأ SQL الجيل الداخلية: مولد مفقود لمتغير"؟

StackOverflow https://stackoverflow.com/questions/253746

  •  05-07-2019
  •  | 
  •  

سؤال

في مايكروسوفت أوسلو SDK CTP 2008 (باستخدام Intellipad) التعليمة البرمجية التالية يجمع ما يرام:

module T {

    type A {
        Id : Integer32 = AutoNumber();
    } where identity Id;

    As : A*;

    type B {
        Id : Integer32 = AutoNumber();
//        A : A;
//    } where A in As && identity Id;
    } where identity Id;

    Bs : B*;

    type C {
        Id : Integer32 = AutoNumber();
        B : B;
    } where B in Bs && identity Id;

    Cs : C*;

}

ووالنتائج في إخراج الوصول SQL التالية:

set xact_abort on;
go

begin transaction;
go

set ansi_nulls on;
go

create schema [T];
go

create table [T].[As]
(
    [Id] int not null identity,
    constraint [PK_As] primary key clustered ([Id])
);
go

create table [T].[Bs]
(
    [Id] int not null identity,
    constraint [PK_Bs] primary key clustered ([Id])
);
go

create table [T].[Cs]
(
    [Id] int not null identity,
    [B] int not null,
    constraint [PK_Cs] primary key clustered ([Id]),
    constraint [FK_Cs_B_T_Bs] foreign key ([B]) references [T].[Bs] ([Id])
);
go

commit transaction;
go

ولكن بعد تغيير الخط علق في وحدة T النحو التالي

        A : A;
    } where A in As && identity Id;
//    } where identity Id;

ورسالة الخطأ "M2037: SQL الجيل خطأ داخلي: مولد مفقود لمتغير 'A'". يتم عرض (في النافذة الوصول SQL Intellipad ل)

وأي أفكار؟

والتحيات، tamberg

هل كانت مفيدة؟

المحلول

وأعتقد أن ما تريده هو:

type A {
    Id : Integer32 = AutoNumber();
} where identity Id;

As : A*;

type B {
    Id : Integer32 = AutoNumber();
    A : A;
} where identity Id;

Bs : (B where value.A in As)*;

type C {
    Id : Integer32 = AutoNumber();
    B : B;
} where identity Id && B in Bs;

Cs : (C where value.B in Bs)*;

لاحظ أن القيود الموجودة على خارجيين، وليس أنواع هنا. وكنت قادرا على الحصول على رمز مماثل عندما القيود التي على أنواع ولكن لا تستطيع أن تذهب علاقة أكثر من واحد عميق. نقلها إلى خارجيين يبدو الصحيح ويولد المتوقع الوصول SQL.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top