Dict. to String and String to Dict. with Visual Works 
Author Message
 Dict. to String and String to Dict. with Visual Works

Dictionary to String and String to Dictionary with Visual Works

Hi,

        I must save object like Dictionary on my SQL/Server.
I want to save a Dictionary (containing all type of object) as string in
a varchar data.
How can i make this? (with de printString method)
And how can I make a Dictionary with this result ?

                                Fred



Fri, 23 Apr 1999 03:00:00 GMT  
 Dict. to String and String to Dict. with Visual Works

Quote:

> Dictionary to String and String to Dictionary with Visual Works

> Hi,

>         I must save object like Dictionary on my SQL/Server.
> I want to save a Dictionary (containing all type of object) as string in
> a varchar data.
> How can i make this? (with de printString method)
> And how can I make a Dictionary with this result ?

>                                 Fred

Fred,

IMHO you have to iterate throu your dictionary and send to
each key and value printString.
Further on you need a special character in order to
distinguish between the different objects.
E.G. you use # as that tag. But you have to scan the result
of printString and change # to <soemthing else>, e.g. \#.

In order to rebuild the dictionary, you have to run throu
the string and extract every substring (that is just
between to #). After that you have to rebuild the different
abjects by aString asMyObject and afterwards rebuild the
associations and add those to the new dictionary.

I would suggest a different version.
Use the storeOn: method in order to get the string
representation and readFrom: to get the object back.
You have to use the same way in order to distinguish
between the different parts of the complete result string.

HTH,
Frank

-- I speek only for myself !! --



Sat, 24 Apr 1999 03:00:00 GMT  
 Dict. to String and String to Dict. with Visual Works

or just use BOSS (or ObjectFiler on Visual Smalltalk) to give a flattened representation
of your object (Dictionary or whatever), and store that output (and read it back in using
BOSS).

Brad

-----------------------

Quote:

> >         I must save object like Dictionary on my SQL/Server.
> > I want to save a Dictionary (containing all type of object) as string in
> > a varchar data.
> > How can i make this? (with de printString method)
> > And how can I make a Dictionary with this result ?

> >                                 Fred



Sat, 24 Apr 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Dict to String and String to Dict with Visual Works

2. converting string to dict ?

3. expanding a list and dict to a *args and **dict

4. Dict can't update with dict-like objects

5. NewBuiltins: added dict() -- inverse of dict.items()

6. Are strings copied when passed to a regex object if a dict lookup

7. Builtin dict should be callable, since a dict defines a funct ion

8. Builtin dict should be callable, since a dict defines a function

9. dict = urllib.urldecode(string) ?

10. Tcl8.5: [string map $dict ...] and ordering inside $dict

11. Question about working with strings and displaying strings properly

12. Visual works: Environment string in Sybase and ODBC ?

 

 
Powered by phpBB® Forum Software