Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkdKW-0003EX-2h for pgsql-odbc@arkaria.postgresql.org; Wed, 14 May 2014 17:51:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WkdKV-0002bb-8H for pgsql-odbc@arkaria.postgresql.org; Wed, 14 May 2014 17:50:59 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkYea-0007uI-LJ for pgsql-odbc@postgresql.org; Wed, 14 May 2014 12:51:24 +0000 Received: from mail-bn1lp0141.outbound.protection.outlook.com ([207.46.163.141] helo=na01-bn1-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkYeU-00079G-Rl for pgsql-odbc@postgresql.org; Wed, 14 May 2014 12:51:23 +0000 Received: from BY2PR08MB281.namprd08.prod.outlook.com (10.242.237.145) by BY2PR08MB281.namprd08.prod.outlook.com (10.242.237.145) with Microsoft SMTP Server (TLS) id 15.0.939.12; Wed, 14 May 2014 12:51:15 +0000 Received: from BY2PR08MB281.namprd08.prod.outlook.com ([169.254.7.145]) by BY2PR08MB281.namprd08.prod.outlook.com ([169.254.7.145]) with mapi id 15.00.0939.000; Wed, 14 May 2014 12:51:15 +0000 From: Barry Bell To: Adrian Klaver , Hiroshi Saito , Michael Paquier , "Hiroshi Inoue" CC: Heikki Linnakangas , Anna Gershnik , "pgsql-odbc@postgresql.org" Subject: Re: psqlODBC text length with no records Thread-Topic: [ODBC] psqlODBC text length with no records Thread-Index: Ac9uszh7MQJ/2SP6QOaa9NAxMqce9AAWBOuAABmcwZA= Date: Wed, 14 May 2014 12:51:14 +0000 Message-ID: <3fca930240554b80bc4174911fb49400@BY2PR08MB281.namprd08.prod.outlook.com> References: <152de38c9c2544b9b61f9a2f77e9aa3d@BY2PR08MB281.namprd08.prod.outlook.com> <5372B875.3010407@aklaver.com> In-Reply-To: <5372B875.3010407@aklaver.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [63.95.64.254] x-forefront-prvs: 0211965D06 x-forefront-antispam-report: SFV:NSPM; SFS:(10019001)(6009001)(428001)(479174003)(13464003)(24454002)(377454003)(199002)(189002)(51704005)(76482001)(33646001)(66066001)(83072002)(64706001)(80022001)(79102001)(31966008)(50986999)(74662001)(87936001)(54356999)(74502001)(15975445006)(81342001)(85852003)(99396002)(99286001)(81542001)(86362001)(19580395003)(46102001)(83322001)(2656002)(74316001)(19580405001)(15202345003)(92566001)(76176999)(77982001)(20776003)(21056001)(4396001)(76576001)(101416001)(24736002); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR08MB281; H:BY2PR08MB281.namprd08.prod.outlook.com; FPR:; MLV:sfv; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (: hartehanks.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Barry.Bell@hartehanks.com; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hartehanks.com X-Pg-Spam-Score: -1.9 (-) 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 Tried every setting for unknown size Abd every settubg fir date tyoe options. and it always comes back as SQllongvarchar (Memo, CLOB). The " Text as LongVarChar: PostgreSQL TEXT type is mapped to SQLLongVarc= har, otherwise SQLVarchar." Is not working when no records are returned It will work if the initcap function is not used. Try it yourself with this sql statement: SELECT initcap('ABCDEF') vv FROM dual WHERE 1=3D0 Will return the a sqlongvarchar(Memo,CLOB) As per your document: Data Type Options: affects how some data types are mapped: Text as LongVarChar: PostgreSQL TEXT type is mapped to SQLLongVarchar, = otherwise SQLVarchar. Unknowns as LongVarChar: Unknown types (arrays, etc) are mapped to SQLL= ongVarChar, otherwise SQLVarchar Bools as Char: Bools are mapped to SQL_CHAR, otherwise to SQL_BIT Unknown Sizes: This controls what SQLDescribeCol and SQLColAttributes will = return as to precision for character data types (varchar, text, and unknown= ) in a result set when the precision is unknown. This was more of a workaro= und for pre-6.4 versions of PostgreSQL not being able to return the defined= column width of the varchar data type. Maximum: Always return the maximum precision of the data type. Dont Know: Return "Don't Know" value and let application decide. Longest: Return the longest string length of the column of any row. Bew= are of this setting when using cursors because the cache size may not be a = good representation of the longest column in the cache. -----Original Message----- From: Adrian Klaver [mailto:adrian.klaver@aklaver.com]=20 Sent: Tuesday, May 13, 2014 8:28 PM To: Barry Bell; Hiroshi Saito; Michael Paquier; Hiroshi Inoue Cc: Heikki Linnakangas; Anna Gershnik; pgsql-odbc@postgresql.org Subject: Re: [ODBC] psqlODBC text length with no records On 05/13/2014 07:04 AM, Barry Bell wrote: > Hi: > When calling PostgresODBC (ver 9.2.1) using the following settings=20 > for VFP(Foxpro)=20 > BI=3D2;TextAsLongVarchar=3D1;UnknownSizes=3D2;UseServerSidePrepare=3D1;B0= =3D254; > B7=3D1;C5=3D0;AB=3D8;" && Debug=3D1;B2=3D1 > > Select initcap(name) cname from customers (where name is type varchar) > If records are returned, Returns pname as the varchar of length of the=20 > field (varchar 30 in this case) So I am going to assume you mean cname above. > But if I run > Select initcap(name) cname from customers where 1=3D0 (no records=20 > returns) If no records return, cname field as "Memo" (like a CLOB) or=20 > longvarchar > > In my connection string, I am setting B0=3D254 meaning any strings under = 254 chracter should be varchar and over 255 should by longchar type(Memo). > And any unknown as longchar type(Unknownsizes=3D2) Well according to here: http://psqlodbc.projects.pgfoundry.org/docs/config.html you should not need to use Unknownsizes for 6.4+ versions of Postgres or i= f you do use Maximum. > > I cannot find any setting that will return the cname field as a=20 > varchar (short char), instead of a longchar type(Memo, CLOB) > > Any ideas? > > Barry Bell > -- Adrian Klaver adrian.klaver@aklaver.com --=20 Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc