TD-4048: Remove distinction String - Long String

Missing or incomplete OpenText Gupta product features? Discuss it here!
User avatar
Charlie
Canada
Posts: 646
Joined: 07 Mar 2017, 18:52
Location: Fredericton, New Brunswick, Canada

Re: Remove distinction String - Long String

Post by Charlie » 01 Jun 2009, 09:20

Thanks Mike and Joe, much appreciated. Nice to know the original design reason/intent for something before changing it.

Ana Paula Bonani

Re: Remove distinction String - Long String

Post by Ana Paula Bonani » 25 Jun 2009, 10:53

All,

In TD5.2 we're actually going to make sure that the documentation is correct as far as String x Long String goes (as we've had some issues in TD5.1 which caused confusion amongst developers)

For now, Unify is not going to change the current implementation of handling those two datatypes. This will be re-evaluated in future releases.

Thanks,

johi

Re: Remove distinction String - Long String

Post by johi » 26 Jun 2009, 02:01

I would be happy with the following (small) change:

Make the Oracle router more tolerant regarding the distinction between TD Long String and TD (short) String <= 254.
It should be safe to use TD Long String as into variable for short db columns.

Long String: sLong
Set bRet = SqlPrepareAndExecute(hSql, 'select \'Hello\' from dual into :sLong')
Set bRet = SqlFetchNext(hSql,nRetVal)
should work as expected by common sense.

Currently, the following error is reported by SqlFetchNext (in TD3.1 and TD5.1)
Invalid long field number
Reason: Attempting to read long data (sqlrlo) or seek a position within long data (sqllsk) and the column number specified is not a database data type of LONG VARCHAR.
....

johi

Re: Remove distinction String - Long String

Post by johi » 24 Mar 2011, 18:20

any news about enhancement request TD-4048?
Mike wrote in May 2009: "Look for this as a new feature in the TD5.2 release." No luck.

Jeff Luther

Re: Remove distinction String - Long String

Post by Jeff Luther » 24 Mar 2011, 19:15

any news about enhancement request TD-4048?
Yes, closed with "As Designed" back in 2009. I agree with that, and from the gist of this thread people don't understand why there are both 'string types' in TD. Here's a little summary to explain why there are both:

Long String -- required only when you are running a SQL query where the DB column type associated with an INTO var as a :longString is a LONG-type so that TD knows to use the correct SQL/API functions for doing "LONG" API operations (sqlrlo, sqlwlo, etc). These operations are required by TD to correctly handle LONG-type data at the DB side. The 'Long' is the indicator to TD that its corresponding DB column type being fetched will be a LONG-type value (LONGVAR, TEXT, etc.) This TD type has nothing to do with 16-bit SQLWindows vs. 32-bit Team Dev. This has been the same since the beginning.

String -- no difference from Long String otherwise. Neither is 'longer' than the other.

johi

Re: Remove distinction String - Long String

Post by johi » 05 Apr 2011, 14:59

Jeff, your post was not helpful at all. I know all too well the difference between String and Long String.
The problem is that this boundary at 254 characters is artificial, as Mike Vandine seems to have understood. This boundary causes a lot of problems and ugly workarounds.

I try to explain my enhancement request TD-4048 once more.

Look at the following 4 SQL statements against an Oracle DB.
Only two of them work as expected. It should not be necessary to modify the SqlWindows program if the data field length returned by Oracle crosses 254

String: sText
Long String: lsText

Set bRet = SqlPrepareAndExecute(hSql, 'select \'Hallo\' from dual into :sText')
! ok: into variable String for value shorter than 255 characters
Set bRet = SqlFetchNext(hSql, nRetVal)

Set bRet = SqlPrepareAndExecute(hSql, 'select rpad(\'Hallo 2\',256,\' \') from dual into :lsText')
! ok: into variable Long String for value more than 254 characters
Set bRet = SqlFetchNext(hSql, nRetVal)

Set bRet = SqlPrepareAndExecute(hSql, 'select \'Hallo 3\' from dual into :lsText')
! not ok: into variable Long String for value less than 255 characters
! Error 210, invalid long field number
Set bRet = SqlFetchNext(hSql, nRetVal)

Set bRet = SqlPrepareAndExecute(hSql, 'select rpad(\'Hallo 4\',256,\' \') from dual into :sText')
! not ok: into variable String for value more than 254 characters
! sText is silently set to empty string
Set bRet = SqlFetchNext(hSql, nRetVal)

FRBhote
India
Posts: 2208
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Remove distinction String - Long String

Post by FRBhote » 06 Apr 2011, 06:15

I fully agree- there are many times when we need to export data as CSV:

SELECT FIELD1 || ',' || FIELD2|| ',' || FIELD3 || ',' || ... INTO :sRec

Some fields are longer than 255 and some are not... :cry:

User avatar
Charlie
Canada
Posts: 646
Joined: 07 Mar 2017, 18:52
Location: Fredericton, New Brunswick, Canada

Re: Remove distinction String - Long String

Post by Charlie » 08 Apr 2011, 13:56

I've been developing with SQLWindows/TD since '93, so I know all too well how much of a pain they (String and Long String) cause.

That said, knowing how much pain LONG datatypes (in Oracle) have caused us over the years, I can't help but feel that:
  • there is nothing arbitrary about the implementation of String and Long String
  • there is nothing trivial about changing TD to have only one string type to handle everything
I support removing the distinction of string and long string, but not at any price. My concerns are:
  • stability of our applications (I have zero risk tolerance in respect to this enhancement)
  • the effort required to implement this enhancement
    • how much time, effort, and money does Unify have to sink into this one?
    • does it delay other (from my perspective) more important enhancements?
I don't like this mess with String and Long String, but I can live with it and work around it. I've been doing that for so long now that it is second nature to me.

micsto
Germany
Posts: 986
Joined: 07 Mar 2017, 16:07
Location: Germany

Re: Remove distinction String - Long String

Post by micsto » 11 Apr 2011, 15:25

Currently we have also a big problem with the distinction String/Long String.
We've build up a test system for software migration. On the test system we have Oracle 10.2.0.4.0, on the production system we have Oracle 10.2.0.2.0.

With 10.2.0.4.0 (test system), the return value of Oracle functions like LPAD, RPAD etc. is treated as Long String in TD.
With 10.2.0.2.0 (production system), the return value of Oracle functions like LPAD, RPAD etc. is treated as String in TD.
The effect is that all Select statements, in which such an Oracle function is used in the select list, doesn't work anymore on the test system because it is fetched into Strings, not Long Strings. To get it work, I have to change hundreds of Select statements from
LPAD( <col_name>, <length>, <pad_str> ) to
CAST( LPAD( <col_name>, <length>, <pad_str> ) AS VARCHAR2254) )

This is really extremely annoying!

I can understand the distinction for "real" long strings ( e.g. Oracle datatype LONG VARCHAR ), but I can't understand the distinction for simple VARCHAR2 strings with a length > 254.

Return to “Enhancement suggestions”

Who is online

Users browsing this forum: [Ccbot] and 0 guests