[Mono-list] Sqlite data type (ALESSANDRO PINNA)

Dan Poage dan.poage at gmail.com
Mon Jul 16 11:00:32 EDT 2007


SQLite essentially has three data affinities (see sqlite.org for more
information on this): TEXT, REAL and INTEGER.  Any datatype in your CREATE
table definition that is not REAL or does not begin with INT (INT and
INTEGER mean the same thing) will be assigned a TEXT affinity.  Bear in mind
that type affinity works differently in SQLite than strict datatypes do in
other RDBMS's.  You can always store any value in an column in SQLite.  The
only way to get the exact syntax from your CREATE TABLE statement back is to
query the sqlite_master table like this:

SELECT * FROM sqlite_master WHERE name = 'my_table_name';

Alternatively you can use:

PRAGMA table_info('my_table_name');

to get each column number and name, along with the datatype that you passed
to CREATE TABLE (not the affinity), nullability, default value and a flag
indicating whether or not it is a primary key column.

Otherwise your managed ADO.NET provider will always report the type affinity
rather than the string that you passed in your CREATE TABLE statement.  Hope
this helps.

Dan Poage


>
> ------------------------------
>
> Message: 2
> Date: Fri, 13 Jul 2007 13:53:26 -0400
> From: "ALESSANDRO PINNA" <airraid75 at gmail.com>
> Subject: [Mono-list] Sqlite data type
> To: mono-list at lists.ximian.com
> Message-ID:
>         <fb0229230707131053s407c7bcfs469b5d5198bc7e11 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi !!!
> I've a nervous breakdown.....
>
> using the sqliteclient.... specify version 3 in the connection
> i create a table with this string
>
> CREATE TABLE schede (indice smallint,scheda smallint ,lezione
> smallint,nome_esercizio varchar(100),num_esercizio smallint,mod_esercizio
> varchar(100),note_esercizio varchar(100),imm_esercizio blob
>
> when i fill the dataset using the sqlitedataadapter
>
> myDAP.Fill(myDS, "schede");
>
> as result the data type in every column is  String String String String
> String String ahhhhhhhhhhhh
>
> Why ?????????
> Help me
> Thanks
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.ximian.com/pipermail/mono-list/attachments/20070713/8412f7e8/attachment-0001.html
>
>
>

-- 
The creator of the universe works in mysterious ways. But he uses a base ten
counting system and likes round numbers.
--Scott Adams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20070716/7d75e032/attachment.html 


More information about the Mono-list mailing list