[Mono-list] Mono.Data.SqliteClient always report text as DataTypeName

Aaron Bockover abockover at novell.com
Tue Dec 13 14:03:15 EST 2005


Internally in sqlite, everything is stored as a string, regardless of
what type a column was assigned during table creation. 

The only way to know the "type" is to parse the table definition from
the sqlite_master table. This should probably be done for convenience
inside Mono.Data.SqliteClient. 

For instance, run this query:

SELECT sql FROM sqlite_master WHERE name="Tracks";

That will return the SQL used to create the "Tracks" table. You can then
parse that result to build a map of column names->types.

There is some example code for this in Banshee:
http://cvs.gnome.org/viewcvs/*checkout*/banshee/src/Database.cs

--Aaron




On Tue, 2005-12-13 at 09:35 -0800, Julien Sobrier wrote:
> Hello,
> I opened the bug 76986.
> With sqlite 3 and  Mono.Data.SqliteClient, GetDataTypeName always return
> "text", even for fields declared as Integer.
> 
> Does anybody knows a workaround to know the actual type of the field?
> 
> Thank you
> Julien
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list



More information about the Mono-list mailing list