Home > database >  Pb system upgrade
Pb system upgrade

Time:09-27

Everybody is good, I want to ask: we use pb team developed a project, now comes to upgrade problem, process, open a computer - & gt; Run my program to detect if there is a update server - & gt; 1, if there are upgrade pop-up tips - & gt; The download file, modify the configuration - & gt; Restart computer
-> 2, if not - & gt; Start the system

Now the key is I don't know how to detect whether there is updated on the server? Master, please grant instruction! Thank you very much!

CodePudding user response:

Add a table to store the latest version of the information, to run the program to obtain information, compare with program version!

CodePudding user response:

Did the new PBD file save to the database, at the beginning of the program is run more time to update

CodePudding user response:

The collection content

PB is used to implement the client program automatically upgrade
The running mode of C/S structure while there is no more easy to extend and B/S structure is simple, but because of its good stability, high security, running speed, etc, are still widely used in various kinds of large application system, some are form mixed operation mode and B/S,
B/S is superior to the one big characteristic of C/S is, the client does not need to install the client software, through the browser can achieve a variety of applications, and the change of the content on the server can be quickly reflected in the client, if the client software automatically upgrade, can make up for the defects of C/S mode in this area, this paper gives a kind of can automatically upgrade client software design, and gives a method to realize the use of PB,
1 implementation approach
The entire software structure including: to upgrade the database server, upgrade agents, the client application, upgrade service management procedures, etc, to upgrade the database save every version of the software version, file name, file contents and other information; Upgrades agents responsible for reading the latest version of the database server information and file information, complete the download and update the latest version, and start the client application; The client application for the client application program software, is the need to implement the updated software; Uploaded the latest version of the program is to upgrade the information management program, used to upload the latest version of the information content and the corresponding files,
Before the client application is running, start a promotion agent, the agent from the database server reads the upgrade information, if there is the latest version, and prompt the user to decide whether to download the latest version, and then start the client application,
Upgrade information using the following data table (soft_fileinfo) maintenance and management, save the file version information, the file version number file name and save the file name of the contents of the documents and files of binary content, create change of SQL statement (ASA7 database) as follows:
The CREATE TABLE dba. Soft_fileinfo (
Version char (14) NOT NULL,//
the file version numberFilename char (30) NOT NULL,//filename
Filedata long binary,//the file content
PRIMARY KEY (version, filename));//the file version number and the file name as the primary key
PB in program implementation method is given below, it is assumed that the client application executable called "sale. Exe", upgrade the database server USES the ASA7,

2 the client update agent program implementation
Create an application in PB, in the application of the instance variables declared in:
String old_version

Declare get_new_filename cursor for
Select filename
The from the dba. Soft_fileinfo
Where the version & gt; : old_version;

In the event of an Open to write the following code:
String ls_newversion
//connect to upgrade server, here we substitute ASA7 database upgrade the database server
The SQLCA. DBMS="ODBC"
The SQLCA. The AutoCommit=False
The SQLCA. DBParm="ConnectString='DSN=EAS Demo DB V4. UID=dba; The PWD=SQL ', ConnectOption='SQL_DRIVER_CONNECT, SQL_DRIVER_NOPROMPT'
"Connect using the sqlca;
If the sqlca. Sqlcode=0 then
//read the local version
RegistryGet (HKEY_LOCAL_MACHINE \ Software \ MySoftware \ "sale", "Version", RegString! , old_version)
//read to upgrade the latest version on the server
The select Max (version) into: ls_newversion
The from the dba. Soft_fileinfo;
//if the latest upgrade server version number is greater than the local version, download the latest program
promptIf old_version & lt; Ls_newversion then
If MessageBox (" note ", "there is the latest version of the program, whether to upgrade immediately?" That Question! YesNo!)=1 then
//download the latest program
String ls_filename
Blob lb_filedata
Blob lb_tempdata
Long max_len=32765
Long ll_len
//by cursor, all need to update the file name, and then to separate
The open get_new_filename;
The fetch get_new_filename into: ls_filename;
Do the while (sqlca. Sqlcode=0)
//get the latest version of the corresponding file content
Selectblob filedata into: lb_filedata
The from the dba. Soft_fileinfo
Where filename=: ls_filename
The order by version desc;
Long ll_file, loops, I
//delete the old version file
FileDelete (ls_filename)
//create a new file
Ll_file=FileOpen (ls_filename StreamMode! The Write! , LockReadWrite! , Append!)
Ll_len=len (lb_filedata)
//as a result of PB in FileWrtie can only write 32765 the size of the file at a time, several times so you have to read and write
IF ll_len & gt; Max_len THEN
IF the Mod (ll_len, max_len)=0 THEN
Loops=ll_len/max_len
The ELSE
Loops=(ll_len/max_len) + 1
END the IF
The ELSE
Loops=1
END the IF
FOR I=1 to loops
Lb_tempdata=https://bbs.csdn.net/topics/BlobMid (lb_filedata, (I - 1) * max_len + 1, max_len)
FileWrite (ll_file lb_tempdata)
NEXT
FileClose (ll_file)
//read the next file content
The fetch get_new_filename into: ls_filename;
Loop
The close get_new_filename;
End the if
End the if
The else
MessageBox (" error ", "failed to connect to upgrade the server")
End the if
//run the application
The Run (" sale. Exe ")

3 upgrade services management program to achieve
Update service management program implementation is actually a maintenance soft_fileinfo table application, you can change the version information, also can add new version information and the file content, this part of the idea is simple, here no longer has all of the code, there will be a new version of the file is written to the database only giving PB method,
Integer li_FileNum, loops, I
Long flen, bytes_read new_pos
Blob, b tot_b
//get the contents of the currently selected file size, sle_filename include file path and file name where
Flen=FileLength (sle_filename. Text)
//open the file
Li_FileNum=FileOpen (sle_filename. Text, StreamMode! , Read! , LockRead!)
//because the FileRead function only read 32765 the size of the data at a time, so first reads
IF flen & gt; THEN 32765
IF the Mod (flen, 32765)=0 THEN
Loops=flen/32765
The ELSE
Loops=(flen/32765) + 1
END the IF
The ELSE
Loops=1
END the IF
New_pos=1
Several times//read all the data in files, in the tot_b variable
FOR I=1 to loops
Bytes_read=FileRead (li_FileNum, b)
Tot_b=tot_b + b
NEXT
//close the file
FileClose (li_FileNum)
Modify the current version of the file content
Updateblob dba. Soft_fileinfo
The set filedata=https://bbs.csdn.net/topics/:tot_b
Where version=current_version;
//if the save is successful, submit the database
IF the sqlca. SQLNRows & gt; 0 THEN
COMMIT;
The else
The rollback.
Messagebox (" error ", "the file content save failed!" )
END the IF

CodePudding user response:

Implementation approach:
Relevant technology on 1,
Pb FTP functions
Pb webservice function implementation
2, the process
(1) to set up a table on the server, mainly used to store the program version number and need to update the file list
(2) through the webservice take to the table of contents, compared with local storage program version number whether need to update the
(3) if you need to update, according to the update file list via FTP to download, and update,

CodePudding user response:

Thank you all for expert advice, this problem is still in the study!nullnull
  • Related