Skip to content

T4 templates linq2db.SQLite.MS fails to generate views with window functions  #3218

Description

@hoangcuongvn

In a sqlite db, if a view uses window functions, linq2db.SQLite.MS fails to generate modes. There is an exception database disk image is malformed as underneath. But that description is not true. If I remove all views that use window functions, linq2db.SQLite.MS properly generates models .

Here is a simple view to reproduce the issue:

CREATE VIEW [MyView]
AS
SELECT 
       [ID], 
       ROW_NUMBER () OVER () AS [Number]
FROM   [MyTable];
Severity	Code	Description	Project	File	Line	Suppression State
Error		Running transformation: code = Corrupt (11), message = System.Data.SQLite.SQLiteException (0x800007EF): database disk image is malformed
malformed database schema (vMyView) - near "(": syntax error
   at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)
   at System.Data.SQLite.SQLiteCommand.BuildNextCommand()
   at System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)
   at System.Data.SQLite.SQLiteDataReader.NextResult()
   at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
   at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.SQLite.SQLiteCommand.ExecuteReader()
   at System.Data.SQLite.SQLiteConnection.Schema_Tables(String strCatalog, String strTable, String strType)
   at System.Data.SQLite.SQLiteConnection.GetSchema(String collectionName, String[] restrictionValues)
   at System.Data.SQLite.SQLiteConnection.GetSchema(String collectionName)
   at LinqToDB.DataProvider.SQLite.SQLiteSchemaProvider.GetTables(DataConnection dataConnection, GetSchemaOptions options)
   at LinqToDB.SchemaProvider.SchemaProviderBase.GetSchema(DataConnection dataConnection, GetSchemaOptions options)
   at LinqToDB.DataProvider.SQLite.SQLiteSchemaProvider.GetSchema(DataConnection dataConnection, GetSchemaOptions options)
   at Microsoft.VisualStudio.TextTemplating424180F073C29AFFD48A1375AF38A739BE0DB16D25ADB6B02356F765586ACE97B940FDA0FE99B22C970DE6B3D5BB2B51F474D9D6A432A6A3A3174D3DAF9E177F.GeneratedTextTransformation.LoadServerMetadata(DataConnection dataConnection) in C:\Users\MYNAME\.nuget\packages\linq2db.sqlite.ms\3.4.4\build\..\contentFiles\any\any\LinqToDB.Templates\DataModel.ttinclude:line 111
   at Microsoft.VisualStudio.TextTemplating424180F073C29AFFD48A1375AF38A739BE0DB16D25ADB6B02356F765586ACE97B940FDA0FE99B22C970DE6B3D5BB2B51F474D9D6A432A6A3A3174D3DAF9E177F.GeneratedTextTransformation.LoadMetadata(DataConnection dataConnection) in C:\Users\MYNAME\.nuget\packages\linq2db.sqlite.ms\3.4.4\build\..\contentFiles\any\any\LinqToDB.Templates\DataModel.ttinclude:line 433
   at Microsoft.VisualStudio.TextTemplating424180F073C29AFFD48A1375AF38A739BE0DB16D25ADB6B02356F765586ACE97B940FDA0FE99B22C970DE6B3D5BB2B51F474D9D6A432A6A3A3174D3DAF9E177F.GeneratedTextTransformation.LoadSQLiteMetadata(String connectionString) in C:\Users\MYNAME\.nuget\packages\linq2db.sqlite.ms\3.4.4\build\..\contentFiles\any\any\LinqToDB.Templates\LinqToDB.SQLite.ttinclude:line 37
   at Microsoft.VisualStudio.TextTemplating424180F073C29AFFD48A1375AF38A739BE0DB16D25ADB6B02356F765586ACE97B940FDA0FE99B22C970DE6B3D5BB2B51F474D9D6A432A6A3A3174D3DAF9E177F.GeneratedTextTransformation.TransformText() in D:\project\GIAPHA\1.0\SOURCE\GBE\GBE.Server\GBE.Data\LinqToDB.Models\GBE.tt:line 21		C:\Users\MYNAME\.nuget\packages\linq2db.sqlite.ms\3.4.4\build\..\contentFiles\any\any\LinqToDB.Templates\DataModel.ttinclude	111	

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions