Explicación del error de Oslo & # 8220; M2037: Error interno de la generación de SQL: ¿Falta el generador para la variable & # 8221 ;?

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

  •  05-07-2019
  •  | 
  •  

Pregunta

En Microsoft Oslo SDK CTP 2008 (con Intellipad), el siguiente código se compila correctamente:

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*;

}

y da como resultado el siguiente resultado de 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

Pero después de cambiar la línea comentada en el módulo T de la siguiente manera

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

el mensaje de error " M2037: Generación de SQL Error interno: Falta el generador para la variable 'A' " se muestra (en la ventana de Reach SQL de Intellipad).

¿Alguna idea?

Saludos, tamberg

¿Fue útil?

Solución

Creo que lo que quieres es:

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)*;

Tenga en cuenta que las restricciones están en los externos, no en los tipos aquí. Pude obtener un código similar cuando las restricciones se encontraban en los tipos pero no pudieron profundizar más de una relación. Moverlos a los externos parece correcto y genera el Reach SQL esperado.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top