Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1acLK6-0001Ov-6x for pgsql-odbc@arkaria.postgresql.org; Sat, 05 Mar 2016 23:09:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1acLK4-000286-V2 for pgsql-odbc@arkaria.postgresql.org; Sat, 05 Mar 2016 23:09:20 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1acLK4-00027z-5D for pgsql-odbc@postgresql.org; Sat, 05 Mar 2016 23:09:20 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1acLK0-0007Kv-IQ for pgsql-odbc@postgresql.org; Sat, 05 Mar 2016 23:09:18 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 0E07A204AC for ; Sat, 5 Mar 2016 18:09:15 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Sat, 05 Mar 2016 18:09:15 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=ENW8DuKuuX5YKeNrN81lMESdVeI=; b=ozXCOA WJ3xVyCK35hNGCtI1lUgAEiADMEW+OIqeYiKX5JYNcUuEPSunOs54jpSERaGu5TC l/x6VabjdnOM8EjmLaYpycPvqxHXQu9bxamvxwcyUEmuuhgkGtkYrpiSmTKyVAFi /YT0JYRJ5YYkrI+t6yyh1vAj/Z6dOa6gqkpJE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=ENW8DuKuuX5YKeN rN81lMESdVeI=; b=f9L8ZyXMZLr26TJbYnxSHA3OUhQIrDujv4x17dn3a2TXRTH UfJOe7OUqYCe9KUZmnOe082hoZsaXK4AdNw5j9oVWrzz6BXAwolJfJthGUPA69nr pazklZU22DSdDJdDnrtXeGkQ1qqSy/DLcjKFtnJfWHK3Z4PE5sKGRR+RBBP0= X-Sasl-enc: MEVByBQgQ6RELjZKsmidl4DvP9/moG3xSVbztB/IG6PM 1457219354 Received: from [192.168.1.2] (174-21-70-246.tukw.qwest.net [174.21.70.246]) by mail.messagingengine.com (Postfix) with ESMTPA id 80B6DC00013; Sat, 5 Mar 2016 18:09:14 -0500 (EST) Subject: Re: Obtaining hundredths of a second data from time data types To: Scott Ferrett , pgsql-odbc@postgresql.org References: <56D92DAB.9010806@ferrettconsulting.com> <56D9D1C1.4060506@aklaver.com> <56D9FC10.50107@ferrettconsulting.com> <56DA0639.8050006@aklaver.com> <56DB4577.7080407@ferrettconsulting.com> From: Adrian Klaver Message-ID: <56DB66CB.1080009@aklaver.com> Date: Sat, 5 Mar 2016 15:07:55 -0800 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <56DB4577.7080407@ferrettconsulting.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org On 03/05/2016 12:45 PM, Scott Ferrett wrote: > Interesting. It looks like PostgreSQL is conforming to the > specification (unlike Microsoft SQL or SQL Anywhere). However, it does > not help me with the underlying problem and that is "How do I get the > fractional part of a TIME field via ODBC?". > > I have tried SQL_C_TYPE_TIMSTAMP, SQL_C_TYPE_CHAR and > SQL_C_TYPE_DEFAULT. None of these return the fractional part of the > time field. I've also tries SQL_C_TYPE_BINARY and get an error > szSqlState = "07006", *pfNativeError = 14, *pcbErrorMsg = 43, > MessageText = "Received an unsupported type from Postgres." > > So how can I get the fractional information? Use?: SQL_C_TYPE_TIME > > Note that I do not have any control of the SQL statement. My code needs > to handle any statement and return all information about the query. > > Cheers, > Scott > > On 05/03/2016 09:03, Adrian Klaver wrote: >> On 03/04/2016 01:20 PM, Scott Ferrett wrote: >>> Here is a screen shot from ODBCTest after Issuing "SELECT ts, t FROM >>> TestTable" and binding an SQL_C_TYPE_TIMESTAMP to each of the two >>> columns: >>> >>> >>> >>> As you can see, the timestamp has the hundredths part filled in where as >>> the time part does not. >>> >>> I also tried binding to SQL_C_CHAR as a work-around. But this made no >>> difference, producing: >>> >>> >>> >>> This is the result of the same select statement run from pgAdmin III >>> showing that there the hundredths part is returned for both fields: >>> >>> >> >> Looks like this is the reason: >> >> https://msdn.microsoft.com/en-us/library/ms712436%28v=vs.85%29.aspx >> >> The identifier for the time ODBC SQL data type is: >> >> SQL_TYPE_TIME >> >> to >> >> SQL_C_TYPE_TIMESTAMP None[b] Data[c] 16[d] >> >> [c] The date fields of the timestamp structure are set to the >> current date, and the fractional seconds field of the timestamp >> structure is set to zero. >> >> >>> >>> >>> Cheers, >>> Scott >>> >> >> > -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc