Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with Postgres ODBC driver
Message
From
10/08/2010 10:09:53
 
 
To
10/08/2010 09:49:54
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgia, United States
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
01475953
Message ID:
01475959
Views:
63
>I am attempting to move a backend from SQLServer to Postgres. I am able to use remove views for both SQLServer and Postgres to move data to Postgres. I am using the PostgresSQL30 ODBC driver with this connection string :
>
>Everything works fine except - All of the character fields (varchars in SQLServer and character varying in Postgres) end up padded with spaces to the maximum length of the fields. If a field has the value 'BOO' and it is put in a character varying field set to 10 then the data would actually transfer as 'BOO '. This won't work and I know that there must be some setting in the connection string that would keep this from happening but I can't find any documentation on it. Any help greatly appreciated!

I personally would use CA to work, because this allows customization of the SQL statements on various levels, so an Alltrim() could be added for variable length fields (as I doubt the ODBC driver knows about them). If you need to use the ODBC driver, setting explicit SQL Insert and update statements with Alltrim(VarLenCharField) should work. Setting the trimmed VarChar in the memvar would work *only* if you fill SQL Insert directly from memvar into Postgres Table with SPT calls referencing these memvars. You are writing into a table fields, thereby padding again - and so the tableupdate moves the padded fields across. But you could also update those fields in Postgre removing the blanks - not too tempting as Postgres uses delete/insert for updates, but you could skip learning about CursorAdapter. If you will continue to work with vfp you should IMHO get to know Cursoradapter or SPT to give you better control.

HTH

thomas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform