SQLite version 3.22.0 2018-01-02 18:11:11
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .head on
sqlite> .mode col
sqlite> create table x(a int_date);

sqlite> pragma table_info(x);
cid         name        type        notnull     dflt_value  pk
----------  ----------  ----------  ----------  ----------  ----------
0           a           int_date    0                       0

create view if not exists SysColumns
as
select ObjectType collate nocase,
       ObjectName collate nocase,
       ColumnID collate nocase,
       ColumnName collate nocase,
       Affinity collate nocase,
       IsNotNull,
       DefaultValue,
       IsPrimaryKey
from (
        select ObjectType,
               ObjectName,
               cid        as ColumnID,
               name       as ColumnName,
               type       as Affinity,
               "notnull"  as IsNotNull,
               dflt_value as DefaultValue,
               pk         as IsPrimaryKey
          from SysObjects
          join pragma_table_info(ObjectName)
     );

sqlite> select * from SysColumns where ObjectType = 'table' and ObjectName = 
'x';
ObjectType  ObjectName  ColumnID    ColumnName  Affinity    IsNotNull   
DefaultValue  IsPrimaryKey
----------  ----------  ----------  ----------  ----------  ----------  
------------  ------------
table       x           0           a           int_date    0                   
      0



---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.


>-----Original Message-----
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Bart Smissaert
>Sent: Saturday, 6 January, 2018 10:45
>To: General Discussion of SQLite Database
>Subject: [sqlite] sqlite3_column_decltype and max and min
>
>Is there any way with sqlite3_column_decltype (or otherwise) to get
>the
>declared data type (as in the table create sql in SQLite_master) when
>it is
>a simple expression such as max and min?
>
>for example we have a table created like this:
>
>create table1([integer_date] int_date)
>
>and we do:
>
>select max(integer_date) from table1
>
>I would then like to get returned int_date, rather than integer.
>
>The custom datatype int_date is needed for formatting purpose to tell
>the
>app that receives
>the data that the column holds dates as integers.
>
>To do this in application code is not that simple, so I hope there is
>some
>simpler way.
>
>
>RBS
>_______________________________________________
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to