On Mon, Dec 16, 2002 at 03:04:48PM +0100, Steffen Goeldner wrote: > Tim Bunce wrote: > > > [...] > > > > Note that DATETIME_SUB is misspelled with > > an SQL_ prefix in the docs. That's wrong. Fixed now. > > Really? > > ><http://msdn.microsoft.com/library/en-us/odbc/htm/odbcsqlgettypeinfo.asp?frame=false>
Ah, thanks for the catch! I'll fix it. [grumble] I'd forgotten that the ODBC 3.5 book I have isn't as accurate as it should be. I can't find my Microsoft book at the moment. > > > 2. What does the DATA_TYPE field contain when this field contains > > > SQL_DATETIME or SQL_INTERVAL? Not that value - but which value? > > > > The "consise" type integer, ie 112 for SQL_INTERVAL_HOUR_TO_SECOND. > > So when SQL_DATA_TYPE = SQL_DATETIME or SQL_INTERVAL then > > DATA_TYPE == DATETIME_SUB. (Yes, DATETIME_SUB does seem redundant > > but that's what the ODBC spec calls for.) > > IMO, there is a hidden rule for interval or datetime data types: > > DATA_TYPE == 10 * SQL_DATA_TYPE + SQL_DATETIME_SUB > > e.g.: > > SQL_INTERVAL_HOUR_TO_SECOND == 10 * SQL_INTERVAL + SQL_CODE_HOUR_TO_SECOND > 112 == 10 * 10 + 12 > > SQL_TYPE_TIMESTAMP == 10 * SQL_DATETIME + SQL_CODE_TIMESTAMP > 93 == 10 * 9 + 3 Thanks, I've added the "DATA_TYPE == 10 * SQL_DATA_TYPE + SQL_DATETIME_SUB" example to the docs. (And put "subcode" in italics as a reminder to me :) Tim.