Объяснение ошибки в Осло & # 8220; M2037: Внутренняя ошибка генерации SQL: отсутствует генератор для переменной & # 8221 ;?
Вопрос
В 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*;
}
и приводит к следующему выводу SQL Reach:
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 "" отображается (в окне Reach SQL Intellipad).
Есть идеи?
С уважением, Тамберг
Решение
Я думаю, что вы хотите:
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)*;
Обратите внимание, что ограничения на внешние, а не типы здесь. Я был в состоянии получить подобный код, когда ограничения были на типах, но не смогли углубиться более чем в одно отношение. Перемещение их к внешним объектам кажется правильным и генерирует ожидаемый Reach SQL.
Не связан с StackOverflow