This is a migrated thread and some comments may be shown as answers.

Broken sql generator?

1 Answer 26 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jose Mejia
Top achievements
Rank 1
Jose Mejia asked on 05 Sep 2014, 01:04 PM
Hi.

I'm using OA version 2014.2.617.2  and sqlite version 1.0.92.0

I have following queries:
private IQueryable<Entity> UserEntities
 {
     get { return _model.Entities.Where(t => t.EntityNamespaces.Any(t1 => t1.User.UserID == _userId)); }
 }
 
 
internal static IQueryable<Entity> SearchEntitiesByTag(IEnumerable<int> tags)
 {
             
     var query = from entity in UserEntities
                         from tag in entity.Tags
                         where tags.Contains(tag.TagId)
                         select entity;
     return query;
  }

which throws error:

SELECT a.[EntityID] COL1, b.[EntityID] COL2, c.[EntityNamespaceID] COL3, c.[Description] COL4, c.[is_default] COL5, c.[is_monitoring] COL6, c.[EntityNamespaceID] COL7, c.[NameSpacename] COL8, c.[OwnerId] COL9, c.[OwnerId] COL10 FROM [Entities] a JOIN [Entities_EntityNamespaces] AS b ON (a.[EntityID] = b.[EntityID]) JOIN [EntityNamespaces] AS c ON (b.[EntityNamespaceID] = c.[EntityNamespaceID]) WHERE EXISTS (SELECT 1                  FROM [EntityNamespaces] d JOIN [Entities_EntityNamespaces] AS e ON (d.[EntityNamespaceID] = e.[EntityNamespaceID]) JOIN [Users] AS f ON (d.[OwnerId] = f.[UserID]) WHERE f.[UserID] = ?                                       AND e.[EntityID] = a.[EntityID]) AND (g.[TagId] IN (?)) ORDER BY a.[EntityID], b.[EntityID]  Telerik.OpenAccess.RT.sql.SQLException: SQL logic error or missing database
no such column: g.TagId ---> System.Data.SQLite.SQLiteException: SQL logic error or missing database
no such column: g.TagId


Entities has many to many with EntityNamespace and Tags.
The previous version of OA ( I guess it was 2013.*.*.*) was ok. It worked. While I got this bug in new OA version.
I rewrite a query which is a little bit costly now...

So what is the problem? Is OA problem or sqlite driver problem?

Thanks in advance.





1 Answer, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 09 Sep 2014, 11:53 AM
Hi Jose,

I tried to reproduce this here with my latest version, but I could not. Most often this is due to the fact that I use a different model or mapping than the one that exhibits the issue. Also, the issue could have been solved already. Would you be able to pass the model to us so that we can have another look into this?

Thanks,
Thomas
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
LINQ (LINQ specific questions)
Asked by
Jose Mejia
Top achievements
Rank 1
Answers by
Thomas
Telerik team
Share this question
or