Oslo错误的解释“ M2037:SQL生成内部错误:缺少变量生成器”?

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

  •  05-07-2019
  •  | 
  •  

在Microsoft Oslo 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*;

}

并导致以下Reach 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'”显示(在Intellipad的Reach SQL窗口中)。

任何想法?

问候,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)*;

请注意,约束是在外部,而不是这里的类型。当约束在类型上但不能深入到多个关系时,我能够获得类似的代码。将它们移动到externs似乎是正确的,并生成预期的Reach SQL。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top