.NET DA LINQ truncates looong field names

net
linq
oxygene

(Birger Buhl Dinesen) #1

When I use LINQ with an SQL statement with long fieldnames, the query execution fails, because the SQL generated by DA LINQ truncates the field names.

Here is SQL example:

select
"D19" as "ImportanceGettingHelpWithCrimeProblemsRate",
"B27" as "ImportanceOfAdviseOfWorkingRelatedTroubleRate",
"C74" as "ImportanceOfTreatmentBecauseOfAlcoholMisuseRate"
from "Table"
where "FieldA" = :FieldA

Debug info from the FirebirdSql.Data.FirebirdClient:

SELECT 
    "t0"."ImportanceGettingHelpWithCrimeP", "t0"."ImportanceOfAdviseOfWorkingRela", 
    "t0"."ImportanceOfTreatmentBecauseOfA" 
FROM (select
    "D19" as "ImportanceGettingHelpWithCrimeProblemsRate",
    "B27" as "ImportanceOfAdviseOfWorkingRelatedTroubleRate",
    "C74" as "ImportanceOfTreatmentBecauseOfAlcoholMisuseRate"
    from "Table"
    where "FieldA" = @FieldA) "t0"

Here is how it is used in code:

var someThing, someThingElse: String;
var tbl := self.LinqDataAdapter.GetTable<Table>([new DataParameter('FieldA',2)]).ToList;
try
  var rec := tbl.First;
  someThing := rec.FieldSomeThing;
  someThingElse := rec.FieldSomeThingElse;
except
  someThing := '';
  someThingElse := '';
end;

Is it not possible to have such long field names in LINQ?

Trying to avoid having to rewrite SQL code from Delphi project.


(Birger Buhl Dinesen) #2

I have checked the DA Schema - and there it is truncated as well - in the field mapping section.
I will try and regenerate the field mappings and see if it helps.


(Birger Buhl Dinesen) #3

It helped to regenerate in the DA Schema. I made no changes to the SQL and it worked fine.


(antonk) #4

In general there are no field name length restrictions (double-checked it).

However it could be that it was some kind of a DB driver limitation (or bug) that resulted in truncated field names.

Note that according to this issue http://tracker.firebirdsql.org/browse/CORE-749 identifier length in FirebirdSQL is limited on the database core level.