Fabio Goncalves · Apr 29, 2016

%Library.GlobalCharacterStream deprecated

On the class reference %Library.GlobalCharacterStream is marked as deprecated in favor of  %Stream.GlobalCharacter.

How I can migrate the data from class properties defined as %Library.GlobalCharacterStream to the new one %Stream.GlobalCharacter? 

Does the %Stream.GlobalCharacter have the same SQL support from %Library.GlobalCharacterStream?


0 973
Discussion (9)2
Log in or sign up to continue

What kind of SQL support are talking about here?

With %Library.GlobalCharacterStream I can simply manipulate the streams with SELECT, INSERT, UPDATE ou DELETE SQL commands. Treating the stream field like a string one.

Side note... While I don't quite understand the need here, this is another case where a table of deprecated classes/methods/keywords would be useful...

Since which version of Caché is this class deprecated? Unfortunately we don't know :(

Looks like the class has been described as deprecated since 2012.1.

A quick test suggests that data migration is indeed required after changing the type of a property from %GlobalCharacterStream to %Stream.GlobalCharacter.

  1. Populate a class with some instances, each containing stream data.
  2. The char_length() function in SQL returns the length of the stream field.
  3. Change the type of the property and populate the class with some more instances.
  4. The char_length() function returns the length for the new instances, but null for the old ones.

I imagine the supported way to migrate is to make a new stream field and copy from the old field using CopyFrom(). I'd be tempted to diddle the stream references to point to the existing data. In any case, if it ain't broke ...

This is the standard behavior to migrate data. But I consider this a bad approach when I´d forced down to it. If some feature you use disapears from your hand, the minimum efort to preserve data must be done by developers.

My applications relly on streams. Now I will need to sneak over COS and classes to migrate my own data to the new datatype. This is bad!

I am really interested in to know if just change my class definition from %Library.GlobalCharacterStream to %Stream.GlobalCharacter is needed considering that it has the same storage mechanism or there is some diferences where is needed to migrate data from %Library.GlobalCharacterStream to %Stream.GlobalCharacter by writing on the new %Stream.GlobalCharacter stream?

Also when using SQL to insert,  update and select %Stream.GlobalCharacter has the same behavior as the %Library.GlobalCharacterStream ? 

1) Deprecated for COS means we simply do not want to encourage people to use these APIs anymore. There is no requirement to merge other then hopefully the benefits in the new code that led to the deprecation in the first place.

2) Atelier has the ability to display any deprecated syntax visually and also link to its documentation, which should have some indication of why it was deprecated and what replaced it.

3) Atelier will also have full refactoring capabilities for updating deprecated syntaxes though that will not cover data migration issues as outlined in this particular case.

4) We also intend to have full support for code analysis in Atelier which can be run and show me anywhere I am using deprecated syntax and suggest solutions.

Thanks Bill;

This brinks up some relief. We´ll migrate the data later in the schedule.