4D v16SP-Based Import (Example) |
||
|
4D v16
SP-Based Import (Example)
SP-Based Import (Example)
The following example shows how importing data can be dramatically accelerated in Client/Server architecture. The Regular Import method allows you to test how long it takes to import records using the IMPORT TEXT command on the Client side:
` Regular Import Project Method With the regular import data, 4D parses the text file, then for each record, creates a new record, fills out the fields with the imported data and sends the record to the Server machine to be added to the database. There are consequently many requests going over the network. A way to optimize the operation is to use a stored procedure to do the job locally on the Server machine. The client machine loads the document into a BLOB, then starts a stored procedure that passes the BLOB as parameter. The stored procedure stores the BLOB in a document on the server machine disk, then imports the document locally. The import of the data is therefore performed locally (at a speed comparable to that of a local version of 4D) because most the network requests have been eliminated. Here is the CLIENT IMPORT project method. Executed on the Client machine, it calls the SERVER IMPORT stored procedure listed just below: ` CLIENT IMPORT Project Method Here is the SERVER IMPORT project method executed as a stored procedure: ` SERVER IMPORT Project Method Note: The On Windows project method is listed in the System Documents section in the 4D Language Reference manual. After these two project methods have been implemented in a database, you call perform a “Stored Procedure-based” import data by writing, for example: CLIENT IMPORT(->[Table1];"Import") With some benchmarks, you will discover that by using this method you can import records up to 60 times faster than with a regular import.
See also
|
PROPERTIES
Product: 4D
HISTORY
ARTICLE USAGE
4D Server Reference ( 4D v16) |