Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert Centura Long String into PostgreSQL Text

Status
Not open for further replies.

gregitg

Technical User
Oct 7, 2001
3
AT
Hi to all,

I experienced a problem when inserting/updating a PostgreSQL table out from Centura Team Developer.

The variable in Centura is defined as Long String and the correspnodent column in the database is defined as text or varchar().

The result is the same. The database sends an error message to use the functions lo_import() or lo_export() for large objects.

Unfortunately take this functions only a filename as parameter. But I have no file at that moment and I do not want to save my variable to a file.

What I want, is to put my Long String from Centura into the Text column in the table (in the same way as it works with varchar(250))

Has anybody an idea how work around this problem?

Any hint is appreciated

With best regards

Hans
 
I use ODBC and PostgreSQL 7.2. on Win2000 with the cygwin environment.

Centura Team Developer is a very comfortable IDE with native database support for many backends. And those which are not supported native, can be accessed via ODBC.

 
Hi gregitg,

Have you tried updating the Centura Team Developer long string to a text field. This might work since a text defined field is not limited.

I extracted the following form the postgres 7.1.2 doc.


3.3. Character Types
SQL defines two primary character types: character and character varying. Postgres supports these types, in addition to the more general text type, which unlike character varying does not require an explicit declared upper limit on the size of the field.

Refer to Section 1.1.2.1 for information about the syntax of string literals, and to Chapter 4 for information about available operators and functions.


Table 3-4. Character Types

Type Name Storage Recommendation Description
character(n), char(n) (4+n) bytes SQL-compatible Fixed-length blank padded
character varying(n), varchar(n) (4+n) bytes SQL-compatible Variable-length with limit
text (4+n) bytes Most flexible Variable unlimited length

Note: Although the type text is not SQL-compliant, many other RDBMS packages have it as well.


There are two other fixed-length character types in Postgres. The name type exists only for storage of internal catalog names and is not intended for use by the general user. Its length is currently defined as 32 bytes (31 characters plus terminator) but should be referenced using the macro NAMEDATALEN. The length is set at compile time (and is therefore adjustable for special uses); the default maximum length may change in a future release. The type "char" (note the quotes) is different from char(1) in that it only uses one byte of storage. It is internally used in the system catalogs as a poor-man's enumeration type.



You may need to try several field type combinations until you find one that maps the Centura Team Developer long string between the front-end and postgres correctly.

Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top