Research on Image Storage Function in Powerbuilder Mode

zhaozj2021-02-16  49

Research on Image Storage Function in Powerbuilder Mode

?

Author: Li Yongchun msn: uit3@yahoo.com.cn posted Please specify the source please correct me

1.1 topic development background

With the development of national economic and social information, all enterprise institutions must have more and more business documents, bank notes, insurance reports, tax tax bills, government documents, personnel files, court litigation, hospital medical records, etc. Difficulties with preservation, classification, archiving and query, and a large number of historical documents are maintained. The traditional manual treatment method has the following questions: it is easy to make document paper to decrease or lose; the personnel and customers within the unit are difficult to discuss and share document data; due to manual consultation methods, the efficiency cannot be kept growing up. The needs of "customer satisfaction". The image storage is mainly for all kinds of documents, documents, subpoena, report original, legal attractions, and the like in the form of image form. It is a new concept of replacing traditional paper and micro-shrinkable film. It uses the image acquisition device to convert the image information of the document to the computer-recognized digital information, compression, store the online storage of massive data to realize the online storage of massive data. It is characterized by facilitating management, query, reducing storage costs. And using a computer network, through the printer output, you can also send it through a fax or email. The advantage is that the picture is more realistic, and the character is more realistic than the text than the text, which can break through the language and text, and people know and love different nationalities and different cultures. Therefore, the application requirements of the image storage management system are increasing. ?????

1.2 Analysis of the status quo of topics

The image store has now been applied to many areas of modern society. The usage methods and techniques in all of these areas are very similar, and examples are listed in the following research status analysis.

(1) Satellite imaging: pictures of the earth or other planets are taken by the cosmic spacecraft and the cameras. The purpose of shooting images of other planets is to study their surfaces to explore the nature or history of planets. The purpose of using artificial satellites against Earth is in meteorology, agriculture, environmental protection and military use.

(2) Air imaging: Take pictures of the surface of the Earth section to investigate the harvest of crops or to draw a map.

(3) Print and handwriting: Identify print or handwritten text is one of the earliest applications of image processing. Automatic reading Postal Coding and Bank Checkings are our application examples.

(4) Barcode: There is a device on most supermarkets, which can read and explain the barcode on the product. Barcode is also used to identify files, biochemical samples, and organizational specimens in hospitals.

(5) Radiology: In the field of medical, radiology is one of the main applications of image processing technology (see Chapter 9). Not only in conventional X-ray inspections, other images obtained in the imaging process such as computer tomography (CT), magnetic resonance imaging (MRI), positron emission tomography (PET), and ultrasonic diagnosis are required to be explained. . In these applications, 3D reconstruction is the subject of particular interest.

(6) Chromosome: Because the chromosome image has a relatively simple structure, the automation of chromosome pairing and chromosome nucleus is the earliest application of image processing in medicine.

(7) Cyrtoscopic and histological: automation or quantitative interpretation of microscope imaging (cells and tissues) is also an example of early application

1.3 Application Prospects of this topic

?? Can be applied to all walks of life. Especially in medical, archive management, cultural relics protection, biological, fingerprint identification system, satellite fields, etc., this application is mainly concentrated in the fields of large number of original documents, such as banks, tax stories, and CAD drawings of the machinery industry. Plant image database, medical, etc.

2.1 Image storage principle

From the structure, the graphic file is divided into two, namely bitmaps and vector diagrams. In the bitmap, the image consists of many screen dots (we usually said), these dots correspond to "bits" in memory, but these "bits" determine the pixel graphical properties, such as pixels. Color, Grayscale, bright and dark contrast, etc. When a pixel is more, the color it can behave is more, richer, from a whole, the color of the image is more beautiful, and the resolution is higher. The two bitmaps, eight bitmaps, etc., which are divided in the bitmap, are the number of bits of the pixel. When the bitmap is enlarged or reduced, the resolution of the image will decrease since the number of pixels is not changed, and the appearance of the image is naturally a discount. I believe that friends are inserted into the image in Word or WPS, and when scheduled, more or less will encounter this situation. In this regard, the shortcomings of bitmap are obvious - fixed images of resolution results in a large-resolution clear image occupying a large amount of space; pixel dispersion makes dynamic images difficult, such as when watching VCD, mosaic, It is caused by pixel loss. Therefore, researchers have developed a new graphic format - vector illustration. As the name suggests, the vector is used instead of "bit" in the bitmap. Briefly, the vector map no longer gives all the pixels of the map, but is marked with the vector to the vector. For example, a vector illustration is on a green background with a black circle. Its expression is to first use statements to call the palette description background, and then describe the size, shape, etc. of the circle with the mathematical formula of the with vector, which makes the magnification, reduction, and movement of the graphic, only put the formula. The vector variable can be changed to change, it can be said that the advantages of the vector map are much: energy can be enlarged, narrowed without distortion; do not need to record the status of every point of the image, thus occupying the same quality and size bitmap There is much less space, which can even easily make animations by changing internal formulas, saving more than bitmaps. This is the case like Flash and CorelDraw, etc.. Diversified image storage methods We now use a wide variety of image storage, and the roots are not inseparable from the two most basic principles mentioned above. Below I will make a lot of graphical storage methods now. ??? bmp (bitmap) - Bitu old ancestors so far, BMP is one of the basic components of the Windows graphics interface, and now Windows's desktop is still inseparable from it. BMP color mode is divided into four types: 2 bits (black and white), 4 (16 colors), 8 bits (256 colors), 24 bits (65535 colors). Since this format is not compressed, the size is huge. A 640 × 480 figure, if the color is rich, it can be up to 1M ~ 2M. Even so, it is now that it is also very popular. It is that it will not lose any image details, even if it is a small point, it is very suitable for use in a strict industry.

JPG, JPEG (JOINED PhotoGraphic Experts Group) - Static Image Expert Group This is another one of the bitmaps. I still remember the scene when I saw JPG format - stunned, it actually pressed a 1.05m BMP pattern into 119K, and on the monitor, and there is no difference. This is the case where the JPEG format has provided 2: 1 to 40: 1 compression ratio, compressed within 8 × 8 area pixel cells, when the cell color value is more than one, then outputs a color, that is It is said that it only has a large color value in which the cell is larger, and this storage value is reduced according to the increase in the compression ratio, and some ordinary people do not know the color change of some ordinary people. Therefore, in the case of using the same compression ratio, some colors are less than a single image distortion, and the opposite is large. So friends may wish to try several different compression ratios to find the best combination between compression rate and distortion. Generally speaking, the bitmap of JPEG format can get 10: 1 compression ratio and we don't think it has a distortion. With this two magic, JPG, JPEG is widely used in various fields, especially on the Internet, can be said that it cannot be in the size of the net. (JPEG format ^ 03020101a ^) GIF - dynamic bitmap open country GIF includes three formats, all of which are 8-bit diagrams, up to 256 colors. One is a static GIF diagram, and the data has been compressed. The other two are GIF89A and GIF87A. Support animation format and transparent effect, the compression method is similar to the static GIF map, can be said to be the continuation of GIF, but because it is not very rich to color, whether it is dynamic or static GIF map, it will use true colored Image distortion. Therefore, the dynamic GIF map generally exists only in the web page, and the static GIF map is used under the double pinch of the PNG format mentioned in JPEG and the following.

PNG - GIF patch version PNG is a newer bitmap format, more useful, because it is similar to the GIF format, support transparent format, but unfortunately, the animation effect is not supported, but the maximum support for 24-bit color, How much makes up for the shortcomings of static GIF. The compression algorithm in the PNG format has its own unique, and the compression capacity of 8 bits and the following bitmap is better than the compression algorithm of JPEG. In the case of the observation of the naked eye, JPEG format is only 20 ~ 25: 1, some 8-bit pictures are stored with a PNG format to reach 40 ~ 50: 1 compression ratio! It can be seen that the previous JPEG has not yet arrived at the loneliness. However, when you use the PNG format to store 24 digits, because it is necessary to keep the transparent format support, the status is terrible, the file is better than the BMP format, it is difficult to imagine how it is calculated.

TIF, TIFF (Taggered Image File Format) - Tag image file format TIF, TIFF is primarily used for a bitmap format of page typography, using LZW encoding compression (with ARJ's compression mode), compression ratio 2: 1, This format is usually used in storage of the OCR software to identify scanning documents.

PCD --Photoshop's patented Photoshop's special bitmap store format, it can be said that its fidelity and BMP have no two, but because it is to record layers, and each layer is an equal size image, the volume is natural BMP is mostly. However, it is precisely because of the presence of this layer, so that it can store the effects of many BMPs that cannot be stored, so many artists, image editors use it to store works.

WMF - Windows-bit file Windows custom vector diagram format, the graphics in the Office Clip Library use this format. CDR - another vector diagram format for selecting the CorelDRAW series software, which can be imported and compressed. Similarly to the vector diagram formats defined by the software such as Photoshop, Freehand, due to their respective compression algorithms, only in the case of uncompressed cases. In addition, there are some common but unused graphics formats, such as PCX, PIC, TAG, etc., there is no more image storage design implementation here.

3.1? Image storage strategy

During the development of the database, some recording information is often required in the database, and these note information is generally large, the format is diverse - if possible, how to implement these, how to implement these The access and preview of different note files has always been a problem that developers concerned. This article introduces three methods for accessing binary information. • The following three methods can be used in the stored storage; method 1: File Save under a fixed path, the database access file path and name? Method 2: Database in the database or Varbinary Type Form storage Reserve Note ???? Method 3: Advantage of the three ways of using PowerBuilder's OLE storage Structure storage Note file ???? Method 1: File Save Under a fixed path, access file path and name in the database can save data Space, avoid the excessively expansion of the database, but the note file must not be lost in a certain directory, and the files in the same directory cannot be renamed, and the management of the file has a certain difficult, and in the OLE control, browse the display memo file Since the server program is called each time, the speed is slow. ???? Method 2: In the database, use the BLOB type or the Varbinary Type Word Save Note file. After the file is stored in the database, you can delete the original temporary file on the hard disk, and no complex binary management is required, and the database can Stored on the web server, it is very convenient to share the data. ??? Method 3: Storage of the Structural Storage Note in the locally. All binary information can be stored in an OLE storage file, and the management is relatively convenient. When the binary information is stored, the original temporary file can be deleted; because the server program is not required to display the storage information each time after the storage file is opened, the access speed is faster. ?

?

3.2? SQL Server 2000 Storage Image Database Design

Image database technology has always been committed to solving effective storage and management issues of massive digital images. It is the inheritance and development of database technology. On the one hand, the image data and text data have essential differences. Traditional database technology for successful applications in text data, if it is constantly moving to the image database, the result is often inefficient, Even invalid; on the other hand, many of the results of traditional databases, such as SQL language, indexing techniques, etc. are worthy of image database reference. The combination of the above two as the mainstream of the current development of the current image database technology.

1.1 BLOB data type

??? blob is a very huge non-binary or character data, usually a document (.txt, .doc) and pictures (.jpeg, .gif, .bmp), it can be stored in the database. In SQL Server, the blob can be text, ntext, or Image data type. The image data type is stored as a binary data in which the length is uncertain, the maximum length is 2GB.

??? BLOB data is different from the normal data type in the SQL Server system, and the data value is stored directly on the user-defined field, and the system opens up a new store page for the BLOB type data. Store these data, the BLOB type data field is stored in the table is only a 16-byte pointer that points to the page stored by the BLOB data recorded. 1.2 BLOB design strategy

??? BLOB data is a large data type, which takes up a large number of hard disk space, memory and network resources, so it reasonably designs a property sheet containing the BLOB data type, which has a large number of storage efficiency and query speed. Impact. The general BLOB design principles are as follows:

(1) Use the BLOB data type or use VARCHAR or VARBINARY data type

??? Binary large objects do not have to be stored as text, ntext, or image data types, which can also be in the table as a VARCHAR or VARBINARY data type village. The selection of the data type is based on the actual size of the BLOB to be stored. If the data will not exceed 8K, then use VARCHAR or VARBINARY data type. If the size of these large objects exceeds 8K, use text, ntext, or image data type.

(2) Storage BLOB in the database or in the file system

The common design problem is to exist in the database or there is a file system. In most cases, it is best to exist image files with other data. There are many advantages because you store the image data file in the database:

??? Easy to manage BLOB and tables are backup and recovery when BLOB is stored in the database with other data. This reduces the chance of forming the form data and the BLOB data, and reduces other users inadvertently deleting paths and risks of the BLOB data location in the file system. In addition, the insertion, update, and deletion of BLOB and other data stored in the database are implemented in the same transaction. This ensures consistency of data and consistency between files and databases. There is also a little benefit that you don't need to set security for files in the file system.

??? Scalability Although the file system is designed to handle a large number of different sizes, the file system cannot optimize a large number of small files. In this case, the database system can be optimized.

The availability database has more usability than file systems. Database replication allows copying, assigning, and potential modification data in a distributed environment. In the case of the main system failure, log transfers provide a method for reserving database backup copies. Of course, in some cases, it will be a better choice to store the picture in the file system: (1) The application using the picture requires data stream performance, such as real-time video reproduction. (2) Applications such as Microsoft PhotoDraw or Adobe Photoshop often access BLOB, which only knows how to access files. (3) There is a need to use special functions in the NTFS file system, such as remote storage.

1.3 Method for storing image data

Establish SQL Server database with Image Yuge

??? When you need to store image data in the SQL Server database, you should first create a database relationship table containing the Image Data Type field. In the data type supported by the SQL Server database platform, the image data type is primarily used to store binary data such as large segments such as image data. The version after SQL Server 7.0, the image type can store 2GB of data.

With the continuous enhancement of the SQL Serve database management system, the performance is continuously improved, and all kinds of data is completely stored and managed by the database management system, which has become the trend of technology development. Only in this way, the powerful function of the SQL Serve database management system can be fully utilized, and the security of data can be sufficient, so that many work such as database replication, data transfer, etc., it is very easy. ?

3.3? Storage technology for PowerBuilder images

In the PowerBuilder program, you are sometimes used to use image files, such as photos in personnel systems, and scanned in personnel files with scanners. However, in PowerBuilder, there is no direct method to read the BMP file into memory and display or write into the database. However, PowerBuilder supports reading and writing of binary files, you can implement the entire BMP file read into the BLOB type variable, now explain it by the following two examples.

First, use the Picture control to store and display images in PowerBuilder

Proceed as follows:

1 Take the bitmap file name. 2 acquisition the length of the file. Calculate the number of times to read files (at a time only 32K data) 3 Open file Use the for loop to read the data in the file into the BLOB variable 4 Create a Picture Control 5 Use the setPicture function display image

Write program code now

PowerBuilder requires a certain code in the OPEN event of each application, enters the application plotter, in which we add the following code to the OPEN event of the PIC application:

Open (w_pic) // Open Program Window Create a "Select and Display Bitchart" in the W_PIC Form, and establish a P_1 (Picture Control) "Open" event in the "Select Bitmap". Write the following code: ?? / * This paragraph code will read a file that exceeds 327680 bytes, which can be used to read the text text and Bitmap image. * /

("// ---- // *****" In the middle is annotated) String Ls_path, LS_FILE, LS_PARMS, LS_DIR, LS_COMMANDINTEGER LS_NUM, LS_CS, IINTEGER FH, RETBLOB IS_PIC_BLOBBLOB LS_BLOB / / Must indicate ls_blob Size string defext = "BMP" string filter = "Bitmap files (* .bmp), * .bmp" Ulong NBR, LS_LENRET = GetFileOpenName ("Open Bitmap", LS_PATH, LS_NAME, Defext, Filter) // Select Open Bits Graph file

If RET = 1 THENLS_LEN = FileLength (LS_PATH) // Number of Byte Length // ------ Calculate the number of times of reading files LS_CS = LS_LEN / (32 * 1024) if MOD (LS_LEN, 32) = 0 THENELSELS_CS = LS_CS 1END IF // ***** ls_num = fileopen (ls_path, streammode!) // Open the selected file // ------ Cycle reads the data in the file into the BLOB variable

IF ls_num>? 32765 THEN

NBR = 1for i = 1 TO LS_CSFILEREAD (ls_num, is_pic_blob) NBR = blobedit (Ls_blob, nbr, IS_PIC_BLOB) Next /// ***** p_1.setpicture (ls_blob) // Display bitmap fileclose (ls_num) end ifndiff ifnd IF

Deposit photos into the database in the program

The database is written and the background database is related to: Take SQL Server 2000 as an example: generally use UpdateBlob and SelectBlob two SQL statements to be implemented. In this case, we only simply perform the deposit and removal operation of the bitmap, so the program window is relatively simple. Its function is to select an image written to the database by "bitmap", and the image writes to the database can be visually visual. First, connect the database and motion run window in the application script: open (w_pic)

Create a "bitgraph enrollment" button control, data window control (used to select a visual picture) and establish a P_1 (Picture Control) in the W_PIC Form

Write in the "Open" script in the form W_PIC:

DW_1.SetTransObject (SQLCA) dw_1.retrieve ()

Writes in the "Click" script of the "bitmap entry" button:

String ls_path, ls_file, ls_parms, ls_dir, ls_commandinteger ls_num, ls_cs, integer fh, retblob ls_blob // ---- select the image to enter a BLOB type variable, the picture read here is not more than 32kstring defext = "BMP" string filter = "Bitmap files (* .bmp), * .bmp" Ulong NBR, LS_LEN, NBR1RET = GetFileOpenName ("Open Bitmap", LS_PATH, LS_FILE, Defext, Filter IF RET = 1 THEN LS_NUM = FileOpen (ls_path, streammode!) IF ls_num $ # @ 60; $ # @ 62; -1 Ten fileRead (ls_num, ls_blob) fileclose (ls_num) end ifndiffiff

// ********

// Get serial number Select Num Into: i from number where no = 1using sqlca;

// Add a record INSERT INTO PIC (NO) VALUES (: i) Using SQLCA;

/ / Picture Write Database UpdateBlob Pic Set Pics =: Ls_blob Where no =: i using sqlca; i = i 1

Update Number Set Num =: iwhere no = 1using sqlca; dw_1.Retrieve () Writes in the "DoubleClick" script of the "Data Window DW_1" button (implementation display Double-click Picture):

BLOB LS_BLOBINT II = INT (this.getrow ()) IF i $ # @ 62; 0 themessagebox ("" ​​"," fffff ") SelectBlob Pics Into: Ls_blob from Pic Where no =: i using sqlca; messageBox (SQLCA. SQLCODE), STRING (Ls_blob)) p_1.setpicture (ls_blob) Endiff

Second, use OLE to access BLOB type data in PowerBuilder

1, OLE's basic concept ???? ole is an abbreviation for Object? Linking? Embedding (Object Links and embedded), which allows Windows applications to share data and programs. • OLE control? OLE control is an OLE object's package container, you can use the function and commands provided by the server application to edit objects, or use automation OLE interaction, activate objects in the program and send commands to server applications. The OLE control in the PB® Window Drawboard allows the user to embed and link components from multiple applications. Establish and set OLE controls? Select the OLE control from the Window section to insert Window. ???? When establishing an OLE control and insert an object, PB will activate the server application to allow editing and modification of the object; after making the object in the OL, you can use the Control Attributes tab. Set the properties of the control. ??? 2.2? Activate the OLE object in the Window Drawboard ??? Select Open in the pop-up menu of the OLE control to activate the OLE object in the discharge board ??? Use the server application to modify the OLE object? End the modification: Make the object to restore Non-active states, just click any area outside of the server application object, you can also close the window of the server application. ?? 2.3? Embedding and link OLE controls ??? You can embed or link OLE objects into your own application. The data of the embedded object is placed in the application. In the development process, these data is placed in the application's PBL library. When the application is generated, these data will be stored in the EXE or PBD file, although it can be modified during the operation of the program. However, the modified data will not be saved; the data of the link object is stored in the PB application, when the link is connected, the data file is stored in the PB application, but the pointer to the reference data is stored.? Use a link Data, the management and saving of the data is responsible by the server application. This can modify processing data with a server application, and the processed data can be saved in the retraction file. The link mode is applied to a data file that requires multiple applications, and any application modifies the data file, which will affect all applications that link the file. ??? 2.4? OLE control Activation How to activate the activation of OLE controls, two activation, OFFSite activation means to open the OLE object separately outside the interface of the PB application, in-place Activation means that the OLE object is opened in the original position of the interface of the PB application. The Dbole default in the data window is the offsite activation method, while the OLE default activation in Window is in-place. ?? In the PB application, you can use the command ??? ole_control.active (offsite) or OLE_CONTROL.ACTIVE (In-Place) to set the OLE object to open the OLE object. ?? 2.5? Setting and inserting the OLE object ?? Can be used when running: ?? ole_control.insertfile (Soucefile)? Insert icon ?? ole_control.objectData? =? Blobvar? Set the object?

3, OLE storage? 3.1? OLE storage (OLESTORAGE) is a repository, which is OLE data, stores a directory structure on disk, which can be an OLE object, or In the OLE object, each object is included in the OLE storage or within the storage within the store. Saved in OLE storage is called OLE stream (OLE? Stream), OLE streaming relationship with OLE objects is like a file with a directory. The storage or sub-storage containing the OLE object can be seen as information belonging to a special server, and each part of this level can be operated by the corresponding server program. OLE storage objects are class user objects, which can illustrate corresponding types of variables, establish corresponding instances and open storage, etc., need to turn off the storage and release the allocated memory after the storage is used. 3.2? OLE Store Opening and Saving ?? OLE Storage You can open with the Open function, the Open function is: ?? olecontrol.open (OLesourceFile), ?? This function is automatically created when OLesourceFile does not exist, so create OLE file also uses this function;? OLE storage can be saved with Save functions, the Save function is: olecontrol.save ()? //? Save the OLE control ?? OLESTORAGE.SAVE ()? // Save OLE Storage? 4, Handle BLOB type data?

For large binary data, in PB? Script, it is represented and processed with a BLOB data type. The SELECT, INSERT, and UPDATE statements in the standard SQL statement cannot directly query the blob type data. Operating the BLOB type data in the PB can only use a dedicated statement, from the database to query the blob type data command is:?

SELECTBLOB? RESTOFSELECTSTATEMENT? {using? TransactionObject};

/ / Update the format of the BLOB type data in the database is:? UpdateBlob? Tablename? Set? Blobcolumn? =? Blobvarible? RestofupateStatement? {Using? TransCtionObject};

If the connection database is Sybase or Server 2000, the selectblob and updateblob statement require the database automatic submission to TRUE, so you must use the command before each calling SelectBlob and UpdateBlob statement, automatic submission of the database The way is set to true, after the end of the UpdateBlob statement, use the command SQLCA.AUTOCOMMIT? =? False, set the auto submission to false. • The parameters of the data (such as Flag), then entered in the box after the modified column (user_name is a column in the DataWindow, representing the name of the input) :? 5, the data window of the data window ?? 5.1? Data window BLOB column function ???? In the PB? DataWindow Drawboard, Dbole control allows users to browse and operate large binary data in the database, that is, through the Dbole control: ???? into the database Store large binary data, such as: Excel worksheet, Word document, video file, image file, etc.

● • Retrieve data from the database to the DataWindow object; • ● • Use the OLE server program to see the modified data;?    ? ● • Save the modified data back to the database;?

5.2? Add the steps of the BLOB column in the data window?

1)? Select the data table with binary fields to establish a new data window (this window can include at least the noter list of non-database tables)? Select Insert? -Control-ole? Data? BLOB? Menu, inserted into the blob column in the Detail section of the Data window, click the mouse, at which time the dialog box shown in Figure 1 is explained below to explain the specific meaning of these attributes? 1)? Client? Class :? Customer class name, default is a DataWindow? 2)? Client? Name: customer name, default as untricled? 3) TABLE:? Select the database table containing the blob column, the field of the selected table will appear on the right of Large • BINARY / TEXT? COLUMN list box. ?

4)? LARGE? BINARY / TEXT? Column: Select a BLOB type field column? 5)? KEY? CLAUSE: Retrieve and update the BLOB data keyword expression in which the variable with the colonial prefix pointed out that the column of the data window object Such as? Expression? ID =: ID, ID is the column in the database table, the variable points to the column of the data window object? 6)? FileTemplate ?: If you need the OLE application server to open the same file each time, in the FileTemplate box Enter the file name. ? 7)? OLE? Class ?: If the OLE application server is not required to open the same file each time, select an OLE class in the OLE Class box, such as PBRUSH. ? 8)? Client? Name? Expression: Displays the text of the OLE server application window title, you can enter: "The ID number corresponding to the record is" ID?

Click the OK button to close the dialog, add the Dbole column to the appropriate location, save the data window.   preview, can access the BLOB data in the database, but only one format of the format selected in the OLE? Class box is available in the new record, and data in a variety of formats cannot be stored; Data in a database can preview data in various formats. ?

6, the source program is established?

1)? First, set the following structure in the database blobsave:?

Field Name  Data Type   Remarks?

ID  CHAR (4) PRIMAIRY? KEY? INDEX?

s_pathcha (50)?

PIC ? binary? (50)?

2) • Establish a PBL library blobsave.pbl? 3)? Is there a blobsave in the PBL library blobsave.pbl?

Setting a database connection program in the app (in this program is an ODBC mode connection database, the reader can change the code of the database according to the different connection methods of the database, the following connection database is changed, as for different connection The method of the database, please refer to the relevant information, this article does not make a detailed introduction):?

Sqlca.dbms? =? "O o"? Sqlca.autocommit? =? False? Sqlca.dbparm? =? "ConnectString = 'DSN = blob'? Connection;? Open (w_main)?

Where the command button CB_PATH Click the code format as follows: Open (w_path)? The code format in the CLICKED of the command button CB_DBBLOB is as follows: Open (w_dbblob)? The code format in the CLICKED of the command button CB_OLEBLOB is as follows: Open (w_oleblob) ?

4) • Create data window DW_BLOBSAVE?

Create Data Window Data Window Data Window Data Window Data Window Data Window Data Window Data Window is as shown in the figure: • ADD, DEL, SAVE, CANCEL,, RETRIEVE, etc. Are the data window DW_BLOBSAVE APPEND? ROW, DELETE? ROW, UPDATE, Retrieve action button. ? First create an instance variable? OLESTORAGE? STOR1? Then set the window W_Path as shown, where the code in the ROWFOCUSCHANGED of Data Window Control DW_1 is as follows:?

Long? row_num?

Row_num = dw_1.getrow ()? if? g? OLE_1.INSERTFILE (dw_1.object.s_path [row_num])? END? IF? The code in the buttonclicked of Data window DW_1 is as follows:? IF? dwo .name = "cbselect"? g? long? row_num? Row_num = dw_1.getrow ()? string? filepath, filename? getFileOpenName ("Please select Remarks File", FilePath, FileName)? dw_1.object.s_path [row_num] = FILEPATH? OLE_1.INSERTFILE (filepath)? END? IF? Save Window W_Path?

6)? Set the window w_dbblob? Open W_Path, save it as w_dbblob, change the code in the rowfocuschanged of Data window dw_1 as follows:?

BLOB? TEXT1? long? row_num? row_num = dw_1.getrow ()? if? row_num> 0? Then? String? id? id? =? dw_1.object.id [row_num]? SQLCA.AUTOCOMMIT = True? SELECTBLOB? PIC ? INTO?: text1? from? blobsave? where? id? = ?: id;? ole_1.objectdata = text1? SQLCA.AUTOCOMMIT = false? END? IF?

Change the code in the buttonClicked of Data Window DW_1 as follows:?

Long? row_num? if? dwo.name = "cbselect"? Then? Row_num = dw_1.getrow ()? String? FilePath, FileName? getFileOpenName ("Please select Remarks File", FilePath, FileName? dw_1.object.s_path [ Row_num] = filepath? ole_1.insertfile (filepath)? END? IF? IF? dwo.name = "cbsave"? THEN STRING? ID? SQLCA.AUTOCOMMIT? =? Trueblob? text1? text1? =? OLE_1.ObjectData? DW_1.UPDATE ()? commit ;?

Row_num = dw_1.getrow ()? id = dw_1.object.id [row_num]? UpdateBlob? blobsave? set? pic? = ?: text1? where? id? = ?: id?;? commit; sqlca.autocommit? =? False? Dw_1.Retrieve ()? Dw_1.scrollTorow (Row_num)? END? IF? Save Window W_DBBLOB7)? Create Window W_OLEBLOB?

Open W_PATH, save it as W_oleblob, write the following code in the window W_OLEBLOB Open event:? Stor1? =? Crete? OLESTORAGE? STOR1.OPEN ("c: /p1.ole")? // Open or create OLE File? Write the following code in the close event of the window W_OLEBLOB:? Destroy? Stor1 Change the code in the ROWFOCUSCHANGED of Data Window DW_1 as follows: • BLOB? TEXT1? Long? Row_num? Row_num = dw_1.getrow ()? If? Row_num> 0? Then? String? ID? Id? =? Dw_1.object.id [Row_Num]? OLE_1.Open (stor1, "w" id)? END? IF? Change the code in the buttonclicked data window DW_1:? Long? row_num? if? dwo.name = "cbselect"? Then? Row_num = dw_1.getrow ()? String? FilePath, FileName? getFileOpenName ("Please select Remarks File", FilePath, FileName? dw_1.object.s_path [ Row_num] = filepath? ole_1.insertfile (filepath)? END? IF? IF? dwo.name = "cbsave"? Then? String? id? row_num = dw_1.gtrow ()? id = dw_1.object.id [row_num] ? OLE_1.SAVEAS (Stor1, "W" ID)?

STOR1.SAVE ()? END? IF?

Save the window W_oleblob, run the application. ?

3.4? Scan storage technology for PowerBuilder images

When developing a information management system, you often have an image, which is also an inevitable trend of the development of the information management system. How do I get the desired image information through the scanner in PowerBuilder? There are three basic methods: • 1 through image processing software, such as Photoshop, etc. 2 2 TWAIN.DLL via the scanner interface. This interface is provided when the scanner is installed, which is actually a plugin plug-in, which controls the scanner through a series of functions; ???? 3 Control the scanner by component technology. ???? Using the first method to reduce the complexity of programming, but the system has a high integration, the user is not convenient; the second method can directly control the scanner in the driver level, can be available on programming The greatest flexibility and controllability; the third method can make full use of PowerBuilder's visual components technology, safe, flexible, and freely utilize scanners. In fact, the third method is also based on TWAIN.DLL of the scanner interface. The method discusses this article uses the third. ???? "Image" option (Windows 2000 is Kadak), which is an OCX component to control the scanner, a total of IMGEDIT, IMGANNTOOL, IMGSCAN, IMGADMIN®, with these four components Basically, you can fully control the scanner. The usage in PowerBuilder is as follows: ???? Start PowerBuilder, select "Import? ActiveX? Control under" Component "menu item, then you can see" Kadak? Image editing control, kadak? Image Scanning control, Kadak? Image management control, Kadak? Image Thumbnail Control, select these four items, then click "Install" button, then see these four components under the ActiveX tongue on the component panel. Icon.

? ---? Imgscan? FileType: The file type of the image (this component supports three types: TIFF, BMP, AWD, JPG); ?? long compressionInfo? Int compressionType ??????? enum 0 - NOCOMPRESSION ??????? ENUM 1 - ccittgroup3_1d_fax ??????? enum 2 - ccittgroup3_1d_modifiedhuffman ??????? ENUM 3 - PACKEDBITS ??????? Enum 4 - - ccittgroup4_2d_fax ??????? ENUM 5 - JPEG ??????? ENUM 6 - LZW? STRING DESTIMAGECONTROL ????????? // Scanning image receiving control name? Int filetype? ???????????????????????????????? ENUM 0 - TIFF ??????? ENUM 1 - AWD_MICROSOFTFAX? ?????? enum 2 - bmp_bitmap ??? ???? ENUM 3 - JPG_FILE? STRING Image ???????????????????? 图 image file Name? Boolean Multipage? Int pageOption ??????? Enum 0 - CreateNewFile ??????? ENUM 1 - PROMPTTTOCREATENEWFILE ??????? ENUM 2 - AppendPages? ?????? ENUM 3 - INSERTPAGES ??????? ENUM 4 - OVERWRITEPAGES ??????? ENUM 5 - PROMPTTOOVERWRITEPAGES ??????? ENUM 6 - OVERWRITEALLPAGES? INT PAGETYPE ??????????????????????????? // can not be set in the program ??????? ENUM 0 - BlackandWhite ??????? ENUM 1 - GRAY1 6SHADES ??????? ENUM 2 - GRAY256SHADES ??????? ENUM 3 - Color16Count ??????? ENUM 4 - Color256Count ??????? ENUM 5 - TRUECOLOR24BIT? ?????? ENUM 6 - HighColor24bit? int Scanto ??????? ENUM 0 - DisplayOnly ??????? ENUM 1 - DisplayandFile ??????? ENUM 2 - FileOnly ??????? ENUM 3 - DisplayanduseFileTemplate ??????? ENUM 4 - useFileTemplateOnly ??????? ENUM 5 - FAXONLY? BOOLEAN SCROLL? BOOLEAN SHOWSETUPBEESCAN? Long Statuscode? Boolean StopScanBox? Real ZOOM? Event:?

? Pagedone () scanstarted ()? Scanuidone ()?

Function:?

? AboutBox ()? Long CloseScanner ()? Int GetCompressionPreference ()? Int GetpageTypeCompressionInfo (int ImageType)? Int GetpageTypeCompressionType (int ImageType)? String GetVersion ()? Long OpenScanner ()? Long ResetScanner ()? Boolean ScannerAvailable ()? SetExternallmageName (string szImageTitle)? int SetPageTypeCompressionOpts (int Compref, int ImageType, int CompType, int ompInfo)? SetScannerName (string szScannerName)? long ShowScannerSetup ()? long ShowScanNew (any modal) ???????? scanning new image Set, modal = true? Long showscanpage (any modal)? Long showscanpreference () ????????? parameter selection? Long showselectscanner () ??????????? Scanner selection? Long Startscan () ?? Start scanning? Long stopscan () ??? Termination scan ---? Imgedit? The properties are mainly controlled by the resolution of the scanning image, the aspect of the image is high, is it allowed to partially select the image? Wait; the method mainly has a copy, cut image to the paste board, copy image, rotate, conflate, and image image from the paste board; print, save, refresh image, etc. ? ---- • About the detailed instructions for the above four OCX components View their own help systems in PowerBuilder. ? Note: How do I use Kadak? Scan control in WindowsXP?

OIPRT400.DLL under the Win98 computer C: / Windows / system directory, Oislb400.dll

Oissq400.dll, OITWA400.DLL, OIUI400.DLL, IMGCMN.DLL, IMGADMIN.OCX, IMGEDIT.OCX, IMGSCAN.OCX, IMGTHUMB.OCX, OIADM400.DLL, OICOM400.DLL, OIDIS400.DLL, OIFIL400.DLL, OIGFS400 .Dll, imgshl.dll, imgocxd.hlp. If you don't find a Win98 computer, you can also extract the above files from the Win98 installation CD, which can quickly find the CAB packets in the Win98 installation CD, such as ImgAdmin. OCX, IMGEDIT.OCX, IMGSCAN.OCX, IMGTHUMB.OCX are in Win98_74.cab. ??? Next, you need to register the OCX file, then the image can run normally. To facilitate copying it to the computer on other WindowsXP, you may wish to establish a batch file REG.BAT under the same directory D: / KodakIMG, then right-click the REG.BAT file to edit it. Command: regsvr32 imgadmin.ocxregsvr32 IMGSCAN.OCXREGSVR32 IMGTHUMB.OCX

After saving and exiting, running the reb.bat, the screen will appear on the screen "DllRegisterServer in imgadmin.ocx", click "OK", will also appear "DllRegisterServer in IMGEDIT.OCX"

3.5? This chapter concludes that this chapter mainly tells the key technologies of image storage in the PowerBuilder mode, and how to achieve principles, providing developers with a specific solution implemented by the PowerBuilder image storage. This allows you to quickly build your own image storage platform. Conclusion

• Through the study of this topic, in-depth analysis of the technical points encountered by PowerBuilder image storage, and proposed relevant solutions.

This topic is based on the management of personnel information as a research background, fully demonstrating the technical point encountered by PowerBuilder image storage, through system testing, this system has reached the design requirements, completing the functional goals and performance requirements of the system. It is basically in line with the needs of the topic and can adapt to general expansion. So far, the system is still unpredictable, and the test proof system is reliable.

references

[1] Ke Jianxun "PowerBuilder? 8.0 Basics" 2002.6.1 ?? Tsinghua University Press

[2] Ke Jianxun "PowerBuilder 8.0 advanced articles and skills" 2002.5.1 Tsinghua University Press

[3] Cui Wei ?? "PowerBuilder 7.0 Reference Manual 2000.11.1? Tsinghua University Press

[4] John W.fronckowiak Edward Whalen Marcilina S.garci "SQL Server 7.0 System Administrator Manual" People's Posts and Telecommunications

? [5] Ding Baokang "database principle" 2000? Economic Science Press

? [6] Lu Lina "Software Engineering" 2000 Economic Science Press,

?

转载请注明原文地址:https://www.9cbs.com/read-15612.html

New Post(0)