Robert Simpson wrote:
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, May 28, 2007 9:11 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Re: CAST



SQLite does not have a dedicated DATE type.

I know that, but why it does't create appropriate column definition ?
create table tab(col date);
creates a table with "date" type.
create table tab2 as select * from tab;
also.
This type does't do much, but it can be queried with
sqlite3_column_decltype.
This way I know what to do with text stored in the database.
Currently the only way I see is to create table and then insert .. as
select
which seems to be weird in presence of a function that "changes the
datatype".


sqlite3_column_decltype() returns the declared type of the column in the
table, not the name of the type declared in a particular row in a particular
column of a table.

I wonder how feasible it'd be to implement an extensible type system into
SQLite's core.  We have extensibility through user-defined functions and
collating sequences, why not user-defined types?

Robert

We actually do that with our Sqlite interfaces. We use the declared type to specify the type and perform a conversion when necessary. For example if the declared type of a column is DATE we know that we actually have a FLOAT so when we call a Javascript SQL function for example the Sqlite user function transforms the floating point number declared as a DATE to be a Javascript Date object.

A FLOAT with declared type DATE may be transformed into a date string in accordance with the rules of the chosen locale when being embedded in an HTML page.

Our applications use DECIMAL arithmetic for accuracy so when a column is declared as DECIMAL its actual type is TEXT but arithmetic rules are applied. If Sqlite has decided to make it an INTEGER or a FLOAT the correct conversion is made with the declared precision and scale.



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to