select max(integer_date) as [max_integer_date int_date] from table1

fetch the cursor.description and split the column name at the space.  The right 
part is the datatype for your handy dandy use.

You may also be able to use the same method in the table declaration, provided 
that the type carries through, but I do not remember offhand.

create table1([integer_date] [integer int_date])

The former is how pySqlite2 links adapters and converters to the query.

---
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