Abstract: This article mainly discusses the PowerBuilder 8.0 application compilation of Windows platforms, including the establishment of the execution file, the creation of the resource file, the establishment of the installer and the addition of data sources and SQL Anywhere database mobile processing. Keywords: software development, PowerBuilder 8.0, application release, setup program production. Introduction Powerbuilder ODBC SQL Anywhere is currently developing a database application very popular. However, PowerBuilder itself is only a development tool. After an application is developed and debugged, we need to establish an executable and ported to the machine's machine, where ODBC configuration and SQL Anywhere installation are difficult, This article discusses the Compilation of key technical issues and solutions based on Windows platforms based on the PowerBuilder 8.0 application. Establishment of files 1. Select PowerBuilder 8.0 in Compilation Format PowerBuilder 8.0 provides two compilation formats for generating executables: pseudo code (Pcode, Pseudocode abbreviation) and machine code. Pseudo code is an explanatory language supported on all PowerBuilder platforms. It is the same as the PowerBuilder Runture (.PBL), which saves a single object in executable state, which is convenient and portable; the machine code is Really completely detached executable of the PowerBuilder environment, its advantages are fast, but the file capacity is relatively large. Selecting the compiled code format is generally based on the following three aspects: 1 speed. If the target is to optimize the running speed and application enhancement script processing, select the machine code. If you use a loop structure, floating point operation or integer algorithm and function call, the machine code will do better than the codes. However, the compilation speed of the pseudo code is very convenient than the machine code, especially the developer to quickly create the executable of the test, 2 size. The pseudo code generated file is smaller than the machine code. If the terminal machine capacity of the application is tense, you need to give up faster machine code and select pseudo code; 3 transplantation. Pseudo code is very useful for cross-platform applications. It can be easily used across platforms, including: Microsoft Windows (16-bit, and 32-bit), AppleMacintosh, and Unix. The machine code is dependent on the platform, which means that the generation and executable application platform is consistent, but it can achieve better performance. 2. Establishment of dynamic libraries Powerbuilder 8.0 Application You can put some objects in the executable, and put it in the dynamic library in runtime, which can be divided into smaller modules for management and maintenance. Select Pseudo Code (PCODE) to generate a PowerBuilder dynamic library (.pbd file), select the machine code (MachineCode) mode to generate a dynamic link library on the Windows and UNIX platforms (.dll file, such as compiling Test.pbl into Test.dll) ), Generate a shared library supported by the platform on the Machine platform (such as Test.Lib). If there are two applications on Windows, the compiled .pbd contains a user object that calls the global external function, in order to ensure that the correct call function must be compiled and published separately. PBD files separately. When establishing a dynamic library, copy the compiled version of all objects in the source library (.pbl file) to the dynamic library. In order to use only the required objects in some libraries, they can put them in a standard PowerBuilder library (.pbl).
When establishing a dynamic library, PowerBuilder does not check all objects, just simply removes the source format of the object, so for some objects that use resources (graphics, icons, or pointers) in the brush or script, if you don't want to provide separate Resources must be listed in the resource file (.pbr) to list these resources so that these resources can be guaranteed to include these resources when establishing a dynamic library. There are two ways to establish a dynamic library: First, it is established in the library management brush; the other is to establish a project object in the project brush. 3, the use of the resource file can contain some resources (graphics, icons, or pointers) in the use of executables or dynamic libraries, or they can be saved as separate resource files (.pbr files). (1) If a single distribution resource is not included in an executable or dynamic library, PowerBuilder looks for the resource by the query path, so it must be put along with the application inquiry. Under the path. Windows's query path is: all directories set in the current directory, Windows directory, Windows system directory, and PATH environment variables. (2) Resource files can replace separate resources using the PowerBuilder resource file (.pbr), where all dynamic allocated resources can also include dynamically assigned data window objects. Powerbuilder compiles these resources to the executable or .pbd file, these resources can be used directly during execution. If the data window control is dynamically allocated, you must create a resource file and include this object in an executable or dynamic library file, or in a separate dynamic library. The resource file (.pbr) is an ASCII code file that lists the various resources (such as .bmp, .cur, .ico, .rle, and .wmf files) and data window objects. Create a text file using a text editor (such as a notepad of Windows), which lists the resource files that are dynamically referenced in the application, list a resource, format, like: appico.icoAppBMP1.BMPAPPBMP2.BMP ... More files and objects It is assumed to be in the current directory, if there is in another directory, must contain the path, format, such as: E: /MYAPPP / Test.jpg. The file name specified in the .pbr file must match the resource referenced in the script, if the path is included, the same path must also be included in the .pbr file, otherwise the PowerBuilder is only simply string comparison This resource cannot be discovered. If the application contains a dynamically referenced data window, the data window object must be included in the .pbr file, the formats such as: myapp.pbl (dw_infodisplay): myapp.pbl is the application library, dw_infodisplay is a data window object, general Is in the current directory or specified path. When executed, if the resource is referenced, PowerBuilder first checks the executable, not finding it in the .pbd file, the file query path is found. When establishing an engineering object in the Engineering Brush, you can specify the resource files it use for the executable or each dynamic library, or use a dynamic library in the library management brush.
Configuring PowerBuilder 8.0 applications Generally release a PowerBuilder 8.0 application, in addition to submitting an application executable file (.exe), the application's dynamic library (.PBD or .dll) should also be included in the following files: 1, Powerbuilder 8.0 Application Running File PowerBuilder 8.0 Application Running File (.dll) should be placed in the same directory as the application or in the directory in the search path. The above files can be obtained at C: / Program Files / Sybase / Shared / Powerbuilder. 2. Database interface All database interface files and drivers (PBTRA80.DLL, PBODB80.DLL, and PBODB80.INI) must be placed in an application directory or system directory. The above files can be obtained at C: / Program Files / Sybase / Shared / Powerbuilder. We copied them to the application directory or system directory. If you use a dedicated database interface and ActiveX, the file you want to copy reference to the PowerBuilder's Onlinebook. 3, Microsoft ODBC drivers and DLLs DS16GT.DLL, DS32GT.DLL, ODBC32.DLL, ODBC32GT.DLL, ODBCAD32.EXE, ODBCCP32.CPL, _ ODBCCP32.DLL, ODBCCR32.DLL, ODBCINST.CNT, ODBCINST.HLP, ODBCINT .Dll, ODBCTRAC.dll The above files can be obtained in the Window system directory SYSTEM32, and the specific path is different from the operating system. We copied them to the application directory or system directory. 4, Adaptive Server Anywhere's ODBC database driver and its support file PBBAS15.DLL, PBFLT15.DLL, PBUTL15.DLL, PBTRN15.DLL, IVPB.LIC, PBDRV15.CNT, PBDRV15.HLP. The above files can be obtained at C: / Program Files / Sybase / Shared / Merantodbc, and we copied them into the application directory or system directory. 5, Adaptive Server Anywhere Running System Document DBODBC7.DLL, DBBACKUP.EXE, DBCON7.DLL, DBISQLC.EXE, DBLGEN7.DLL, DBLIB7.DLL, DBODTR7.DLL, _DBTOOL7.DLL, DBUNLOAD.EXE, DBVALID.EXE, DBENG7. EXE, DBCTRS7.DLL, DBSERV7.DLL, DBWTSP7.DLL. The above files can be obtained at C: / Program Files / Sybase / SQL Anywhere 7 / Win32, and we copied them to the application directory or system directory. 6, OLE system file If the OLE control is used in the application, then the OLE system file should be: compobj.dll, ole2nls.dll, ctl3dv2.dll, ole2prox.dll, ole2.dll, Storage .Dll, ole2conv.dll, _typelib.dll, ole2disp.dll, tdole.tlb If they do not exist, we copied them into the application directory or system directory. All support files listed above are not necessarily copied to the application directory or system directory, and the specific can be determined flexibly according to the situation.
Before publishing applications, what dynamic link libraries need to be included in determination, a more feasible and reliable method is: (1) Copy the generated application to the other unrupted PowerBuilder and run it. (2) Find the dynamic library that the application prompt is not found. (3) Copy the corresponding dynamic library file from the machine to develop the application. (4) Repeat (2) (3) two steps until all dynamic link libraries are included. The application developed on the Windows platform can not be published and installed in a simple COPY in the DOS environment. Therefore, making a setup program (SETUP) is an essential important step for Windows compliance applications. 1. The only purpose of SETUP's basic function setup program is to install applications, which should be processed by it to complete the installation process, and the SETUP program should have the following basic functions: (1) Transfer files. Transfer the applications and related support files that need to be installed to the target machine, and process errors during the transfer process. This is the most basic feature of the setup program. (2) Inquiry the end user about the necessary information, such as user name, product serial number, target path, etc., and respond to user input. (3) Give the user to change the opportunity to change the idea, such as changing the installation path, cancel the installation, etc. (4) Registry Access. If you set the application lookup path key, create an application information key, etc. (5) Uninstall function, the installed file and the settings of the registry should have the registry to uninstall the registration function so that the user will successfully uninstall the application and change the registry without the need. (6) The installation should be given to the user to complete the prompt. 2. Many rules should be compliant when the application is installed on the machine, and most of them are common. They make the user's application maintenance easier, and there are fewer problems caused by file replication. (L) You should avoid copying any files into the system directory, unless you are upgrading common files used by external applications (for example, ODBC or native database drivers). This helps to avoid downgrade the performance system due to files that have changed these areas. (2) If the file is a universal file shared between a single user's application, an entry should be established in the Program Files subdirectory Common files. (3) In Windows, the user's own application should be placed in the Program Flies under their directory. (4) For Windows, support files (.hlp, .dll, etc.) should be distributed in a subdirectory called System users' own applications. Then register its location in the registry of the AppPaths subkey at the application's HKEY_LOCALMACHINE / SOFTWARE entry. (5) You should use the registry to store all the required information about the application, and should not modify the INI file of System.ini, Win.ini or the application. (6) Make an entry in the startup engine of the operating system to provide access to the user application. For Windows, a shortcut map of the app should be placed on the desktop or in the program folder of the Start menu. (7) Users to place any files in the system directory should be registered in the Sharedll sub key of HKEY_LOCALMACHINE. 3. Select InstallShield for InstallShield software in InstallShield Software, is the famous installer production software developed by InstallShield software. InstallShield provides easy-to-use wizards and an integrated environment to help create an application installer.
But the use of InstallShield is more complicated, and installshield is not free software, but a copyrighted commercial software. Most PowerBuilder 8.0 books are extremely simply prompting the installation of installshield when talking about publishing applications. Introduction of information in installshield is very small. Therefore, there is often a lot of difficulties. Compare commonly installed production tools when installing programs are CreateInstall 2000. It is a shared software that supports Chinese. Can be downloaded at www.gentee.com. If there is no registration, the prompt information will be prompted when making a good installation disk, but the function is not limited. Another easy-to-use installation tool than InstallShield is gp-install. GP-INSTALL is a free software prepared with Delphi. Although it is free software, it is not said that its function is relatively small, or not strong enough. On the contrary, a function of installing software should have a lot, and it is quite convenient and practical. There are about 2m after the entire software installation, just the zero head of InstallShield. Installshield Some features GP-Install basically have, and the generated installer interface is also very similar, but GP-Install is more intimate. GP-Install has a biggest feature that allows to generate a setup with multi-language, including a variety of languages in a setup, and if you have the language you have in installation, install (uninstall) What languages will also be displayed. This is very useful for programmers who want to promote their own procedures to other countries and regions. GP-Install Home: http://www.qsc.co.uk, you can download one of the latest versions, the latest version is 5.0.2.57. Others have some more commonly used software that makes the installation program with Setup Factory, etc. 4, add registry information this is the most critical! The configuration of the installation and data source of the ODBC is involved. Don't make a mistake, otherwise you will abandon it. There are two ways to add registry information: (1) Direct addition, mainly when manually adding data sources or creates an installer. It is generally only necessary to set the following: Root key key value name value HKEY_CURRENT_USER SOFTWARE / ODBC / ODBC.INI / DEMO (replace with your own data source name) Autostop Yeshkey_current_user with DatabaseNameDemo (replace with your own database name ) HKEY_CURRENT_USER above DatabaseFiledemo.db (replace it with your own database files) HKEY_CURRENT_USER above DriverC: / Program files / Sybase / SQL Anywhere 7 / win32 / dbodbc7.dllHKEY_CURRENT_USER ditto ditto PWDSqlHKEY_CURRENT_USER UIDDba sometimes have to set the following items:
Root key key value name value hkey_current_user software / odbc / odbc.ini / demo (replaced with your own data source name) Description My database (replace it into your database, you can be Chinese) HKEY_CURRENT_USER I am in enginename my database (replaced with your own data engine description, may be Chinese) HKEY_CURRENT_USER above StartC: / Program Files / Sybase / SQL Anywhere 7 / win32 / dbeng7.exe -c 8m, 0HKEY_LOCAL_MACHINEsoftware / ODBC / ODBC DriversAdaptive Server Anywhere 7.0InstalledHKEY_LOCAL_MACHINEsoftware / ODBC / Adaptive Server Anywhere 7.0 DriverC: / Program Files / Sybase / SQL Anywhere 7 / win32 / dbodbc7.dllHKEY_LOCAL_MACHINE software / ODBC / Adaptive Server Anywhere 7.0SetupC: / Program Files / Sybase / SQL Anywhere 7 / win32 / dbodbc7.dllHKEY_CURRENT_USERsoftware / ODBC / ODBC .INI / ODBC data sources your own data source name, such as: demo Adaptive Server Anywhere 7.0HKEY_LOCAL_MACHINEsoftware / Microsoft / Windows / CurrentVersion / App Paths / MyApp.exe (replace their executable file name) PathC: / Program files / sybase / shared / PowerBuilder; c: / program files / sybase / SQL Anywhere 7 / win32 /; C: / Program Files / Sybase / Shared / MerantODBCHKEY_LOCAL_MACHINE software / Microsoft / Windows / CurrentVersion / App Paths / MyApp.exe (replace their Can execute? Default MyApp.exe (replace with your own executable file name) The above is the registered executable and search path. You can also change to another path. The specific situation is flexible when making an installer. (2) Dynamically add ODBC data sources in PowerBuilder, mainly using PowerBuilder's registry operational registrySet (), and then uses PowerBuilder's ProfileString () function and setProfileString () function to read and set ini configuration files. Pre-defined parameters. RegistrySet (Key, Valuename, ValueType, Value) Features: Sets information in the registry in the PowerBuilder program. Key represents the primary key; VALUENAME indicates the key value name; the valuePE indicates the key value type; the value represents the key value. ProfileString (FileName, Section, Key, Value) Features: Read information in the INI configuration file in the PowerBuilde program. FILENAME represents the file name; section represents the segment name; Key represents the keyword; Value represents the keyword value.
SetProfileString (FileName, Section, Key, Value) Features: Sets information in the INI configuration file in the PowerBuilde program. FILENAME represents the file name; section represents the segment name; Key represents the keyword; Value represents the keyword value. At this point, ODBC and data sources are configured. For different database management systems, the above methods and statements are different, but the user can use the following method as a basis for adding an ODBC data source using the program: 1 Open the ODBC Data Source Manager in the control panel, manually add a data source. 2 Running regedit, open the Registry Editor, find the data source that just added, and record the value of each key value. 3 Write the value of each key value into the registry in the installer or in the PowerBuilder program. Of course, some key values will definitely be different, such as the specific path of the database, and the like. 5, the mobile handling of the database file (.db) In PowerBuilder 8.0, the SQL Anywhere database consists of .db and .log two files, respectively, where .db's file is used to store database information (including table structure, view) , Data, etc.). And the .log file is a log file that records the operations that the user has an impact on the database, such as creating or deleting objects, views, triggers, etc. Object, insert, delete, modify data in the table. When we build a SQL Anywhere database, the corresponding .log file is established by default .log files. When you move the SQL Anywhere database, you first copy the .db file and .log file, configure the ODBC, and set up PROFILE in PowerBuilder. But log files (.log) often bring some trouble, so that the database does not easily move to other machines. Because if SQL Anywhere stores the path information of the log file to the database when the database is created, then you copy the database to another machine, if the directory is different, the database is not connected. The general solution is to establish a corresponding directory on the end user machine. That is, if the .log file path is: h: /pb8.0/share/myapp.log, first create a virtual disk having a disk number H: on the end user machine, and establish a corresponding directory. Copy myapp.log into this directory (you can also re-create .log log files) to open and call the database. Another solution is: re-register .log file, enter SQL Anywhere's Win32 directory in DOS mode, run dblog -t x1: /path1/xxx.log x2: /path2/xxx.db. Where x1: /path1/xxx.log is the path and name to be placed in the generated new .log file. X2: /path2/xxx.db is the .db file you want to use now. Be careful not to make mistakes. Under normal circumstances, if it is not required to be too high, you can omit the .log file, that is, do not accompany the .log file when you build a library, such a library file is also convenient.