home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
example_application.sra
< prev
next >
Wrap
Text File
|
1997-09-30
|
3KB
|
83 lines
$PBExportHeader$example_application.sra
$PBExportComments$Example application based on PB template application
forward
global transaction sqlca
global dynamicdescriptionarea sqlda
global dynamicstagingarea sqlsa
global error error
global message message
end forward
global type example_application from application
end type
global example_application example_application
on example_application.create
appname = "example_application"
message = create message
sqlca = create transaction
sqlda = create dynamicdescriptionarea
sqlsa = create dynamicstagingarea
error = create error
end on
on example_application.destroy
destroy( sqlca )
destroy( sqlda )
destroy( sqlsa )
destroy( error )
destroy( message )
end on
on open;/*******************************************************
* Application Open Script
* Selects start-up file according to Operating System
* Populates sqlca from start-up file
* Connects to DB (if uncommented)
* Opens frame
*/
environment env // holds environment information
string startupfile // holds name of start-up file
/* Get the environment information */
IF ( GetEnvironment(env) <> 1 ) THEN
MessageBox( "Application: Open", "Unable to get environment information.~nHalting ..." )
HALT
END IF
/* Select start-up file by operating system */
CHOOSE CASE env.OSType
CASE Windows!, WindowsNT!
startupfile = "pb.ini"
CASE Sol2!, AIX!, OSF1!, HPUX!
startupfile = ".pb.ini"
CASE Macintosh!
startupfile = "PowerBuilder Preferences"
CASE ELSE
MessageBox( "Application: Open", "Unrecognized operating system.~nHalting ..." )
HALT
END CHOOSE
/* Populate sqlca from current PB.INI settings */
sqlca.DBMS = ProfileString (startupfile, "database", "dbms", "")
sqlca.database = ProfileString (startupfile, "database", "database", "")
sqlca.userid = ProfileString (startupfile, "database", "userid", "")
sqlca.dbpass = ProfileString (startupfile, "database", "dbpass", "")
sqlca.logid = ProfileString (startupfile, "database", "logid", "")
sqlca.logpass = ProfileString (startupfile, "database", "LogPassWord", "")
sqlca.servername = ProfileString (startupfile, "database", "servername", "")
sqlca.dbparm = ProfileString (startupfile, "database", "dbparm", "")
/* Uncomment the following for actual DB connection */
//connect;
//
//if sqlca.sqlcode <> 0 then
// MessageBox ("Cannot Connect to Database", sqlca.sqlerrtext)
// return
//end if
/* Open MDI frame window */
Open (w_genapp_frame)
end on