Download - Integration New Media
Transcript
Retrieving Data
In Logon.DIR, data is retrieved from the remote database for a
few different reasons, such as
• matching a nickname's password against the one supplied by
the user, or
• retrieving the user's first name, last logon date and number of
logon's to display on the Welcome screen.
In this section, you will learn how to retrieve the user's last name
from the database and display it on the Welcome screen.
GetField
Other data retrieval methods are
GetSelection and GetMedia.
See the GoldenGate Developer's
Manual for details.
Data retrieval is primarily performed by the GetField method as
in this excerpt from the CheckAndLogon handler (in cast
member #3):
nbrOfLogons = gT.GetField("NumberOfLogons")
This statement retrieves the value of field NumberOfLogons of the
current record in table gT (which refers to table Users, as shown
in Initializing GoldenGate, 3c).
Retrieving the user's last name
As shown in Appendix: Database
Structure, the user's last name is stored
in a field named LastName, which is
the parameter passed to GetField.
1 To modify the CheckAndLogon handler and make it display the
user's last name as well as the first name and logon
information, first add this statement (shown in bold):
-- gets here if nickname and password valid
lName = gT.GetField("LastName")
fName = gT.GetField("FirstName")
nbrOfLogons = gT.GetField("NumberOfLogons")
lastLogon = gT.GetField("LastLogon", "d MMMM yyyy
hh:mm:ss")
2 Then, modify the last statement to:
Member("txt.WelcomeMsg").text = "Welcome back," && fName
&& lName & "." & RETURN & "You had last logged on:" &&
lastLogon & "." & RETURN & "You logged on a total of"
&& nbrOfLogons && "times to this system."
This same operation would have
involved server-side script
modification, query encoding, result
parsing and/or character set translation
in technologies other the GoldenGate.
3 Run the movie.
4 Log on with the nickname and account you created earlier in
Explore the landscape.
The Welcome screen will now display both your first and last
name.
GoldenGate Database Connector™ – First Steps for Director
8