Cache Newbie - how to map a global for ODBC access

18 views
Skip to first unread message

cmarshal

unread,
Sep 19, 2001, 9:48:25 AM9/19/01
to x...@info2.kinich.com
Hello,

I'm a total newbie to Cache so please forgive my ignorance :) Can
someone tell me
how I map a global like this:

^PAT("DATA",PTID)=PTNAME^PTPHONE^PTADD1^...etc
^PAT("NAMEINDX",PTNAME)=PTID
^PAT("ZIPINDX",PTZIP)=PTID

Such that I could query from an external database (Oracle) using SQL and
the Cache ODBC driver?

thanks,

chuck marshall
University of Michigan
Medical School Information Systems
email: cmar...@umich.edu


Tony Zerbe

unread,
Sep 19, 2001, 1:24:01 PM9/19/01
to x...@info2.kinich.com
You have to use the Cache Architect and you will be creating a new class
which can be called anything. The wizard will ask for a package name which
can be anything and will ask for a class name and give you a list of
superclasses to inherit from. You will be inheriting from the Persistent
class.You create the properties that match the properties in your data.

Then double click on the new class in the left hand window. This will bring
up the class specific tab. Select the storage tab and create a new storage
definition by simply clicking on the new icon. Select the CacheSQLStorage
class to subclass the storage method from. Then double click on the storage
method and it will bring up the mapping window. You will have to create a
map for the data and an index map for each of your indexes.

In the datamap add each of you properties and specify that they are stored
as piece with a delimiter of "^" and indicate what piece or sequence number
the property is in the row. There also is a tab where you tell the class
where the data is stored. It will ask for a global name. If the data is
stored in another namespace from the namespace you are creating objects in
the you use the following syntax

^["namespace"]PAT. If the data is in the same namespace as the object map
then use ^PAT.

You will then have to create subscripts to define the access path. There
will be two subscripts one being the string literal "DATA" and the second
being the PTID which is a field. You then need to create a rowid which is
the unique rowid for the data. That is the PTID field.
After that is all done you exit the map and enter the index tab. There you
create a new index called RowIDBasedIndex for lack of a better name. The
index property is PTID and the type of index is unique.

Exit out of these windows and compile the class. If you dont get any errors
from syntax or spelling then you should be able to get to the data from
ODBC. Dont make any other indexes until you that to work. I hope that helps.
You could also look at the tutorials that come with Cache if some of this is
not clear which is likely if you have not done this before.
"cmarshal" <cmar...@umich.edu> wrote in message
news:3BA8A228...@umich.edu...
Reply all
Reply to author
Forward
0 new messages