Massive.Sqlite.cs — Prototype fails because there is no COLUMN_NAME; Fix using PRAGMA table_info?

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

  •  26-10-2019
  •  | 
  •  

Pergunta

I having playing around with Rob Connery's Massive.Sqlite and I have a problem when the Prototype property is called: gets the schema base on this SQL sentence

SELECT * FROM sqlite_master WHERE type = 'table' and name = @0

Where @0 is the name of the table. Now, using the results from that query it tries to create an Expando set with the DB's defaults and, to do so, tries to access a property in the set named COLUMN_NAME which do not exists in the set (the columns there are: type, name, tbl_name, rootpage, sql).

So I thought that I could fix it using a SQLite Pragma:

PRAGMA table_info('table_name');

But that did not worked either, this time because I get no results when the pragma executes.

Is there something I am missing? Do I have to active the pragma in the connection string? Is there a better way to solve this?

Or maybe I am just facing the problem with the wrong solution.

Thanks for your answers!

Technical Notes:

  • Using System.Data.SQLite version 1.0.66.0 from Nuget
Foi útil?

Solução

You are right, the Sqlite Schema detection is broken in Massive. It's already reported on github issue#86 but the fix hasn't been applied.

I've just created a pull request with the fix: https://github.com/robconery/massive/pull/122 you can get the code from there or from the main massive repository after it's merged.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top