Re: psqlODBC text length with no records - Mailing list pgsql-odbc

From Barry Bell
Subject Re: psqlODBC text length with no records
Date
Msg-id cf37441632de482d86f3851926c2a59b@BY2PR08MB281.namprd08.prod.outlook.com
Whole thread Raw
In response to Re: psqlODBC text length with no records  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-odbc
None of the below information helps because we are taking the output cursor
From the postgrest sql,  putting it into a VFP grid and displaying to the user.

With theB0(Max varchar)=254 setting, Postgres for lengths 1-254 returns a "char"
  In vfp, when displayed to the user in a  grid, the value of field is shown

With theB0(Max varchar)=254 setting, Postgres for lengths=0 or null returns a "Memo"
  In vfp, when displayed to the user in a grid, "Memo" is shown in the field instead of the value

With theB0(Max varchar)=254 setting, Postgres for length over 256 returns a "Memo"
  In vfp, when displayed to the user in a grid, "Memo" is shown in the field instead of the value
We only have some code after the sql that sorts the cursor and VFP is unable to sort on the MEMO fields.

Our issue is when Postgres is returning a fireld with 0 or null length,
The driver is not using the B0(Max varchar) setting.

Barry Bell
Senior Developer/Analyst
Logistics
Harte Hanks
1525 NW 3rd ST
Deerfield Beach FL, 33442
954-429-3771 Ext 267 office
954-281-1464 fax

hartehanks.com / linkedin / twitter / facebook

-----Original Message-----
From: Adrian Klaver [mailto:adrian.klaver@aklaver.com]
Sent: Wednesday, May 14, 2014 12:00 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/14/2014 08:29 AM, Barry Bell wrote:
> Sending the SQL through the postgres driver to a Postgres ver 9
> server, where it runs, I see the data types in the client software
> that is calling the ODBC driver (in this case VFP, foxpro).

To follow up, from here:

http://foxcentral.net/microsoft/WhatsNewInVFP9_Chapter09.htm

"Because the DBF structure hasn't changed significantly (although the new data types have some impact on the structure;
seethe "How the new data types affect DBF files" section later in this chapter), Varchar fields are actually stored as
fixedlength fields. However, when you access a Varchar field, the value appears to be trimmed rather than padded with
spacesto the length of the field." 

but

"By default, text boxes pad values with spaces to the maximum width of the field. To suppress that behavior, add "F" to
theFormat property of the Textbox. You should also set MaxLength to the width of the field to ensure the user can enter
themaximum number of characters if necessary.  
To see an example of this, run TestVarcharInTextbox.SCX, type something like "test" in both text boxes, and click on
theResults button. Because the second text box has "F" in its Format property, its content is trimmed while the content
ofthe first one is not." 

>
>
> Barry Bell
> Senior Developer/Analyst


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-odbc by date:

Previous
From: Barry Bell
Date:
Subject: Re: psqlODBC text length with no records
Next
From: David Johnston
Date:
Subject: Re: Fetching Date and Timestamp values