-    CSV Driver    

Read and Write Comma Separated Files in Uniface

Using the UD8/CSV Driver you can read and write CSV files from Uniface as easily as any other data source, plus you can dynamically assign the filename.

Whilst most Uniface applications revolve around processing of information in a database, the need to process delimited text files has never gone away.

Whether it be reading CSV files from products like Microsoft Excel, or creating data files for use with Sybase BCP or Oracle SQL*Loader, Uniface projects inevitably require a solution to be found.

March Hare have taken advantage of the Uniface Database Connector API to provide the simplest most efffective way of transferring delimited text files (comma separated files) to and from Uniface.

What no other solution offers

Since our solution is built as a Uniface driver, it is supported on all current, past and future versions of Uniface. It also means that you have access to the full functionality of a database. Read records based on a selection profile (eg: read u_where (field1="A") ).

Records can be read and/or written with the same ease as you read and write records from any other database with Uniface. Customising the UD8/CSV driver to read your format of file is as simple as setting USYS$UD8_PARAMS in your assignment file. Some of the many formats supported:

Delimited text (including comma separated, tab separated etc)

Dynamically choose the name of the file

Whilst UD8/CSV is a database driver, it does some things that no other Uniface drivers do. In Uniface you define a logical enity name, which is mapped to a physical table name at run time, the name of which comes va the settings in the assignment file.

Unfortunately you cannot alter this mapping once the session has started. Since being able to name the file dynamically is fairly important in CSV file processing, March Hare found a way to simply work around this

Before the table is opened (first read or write after a logon operation with the proc statement open), the developer can use the sql proc statement to send the driver mapping information. For detailed examples please see the article Using UD8/CSV.

This feature can even be used with other drivers like Oracle and DBase III. See the article Dynamically assigning physical tablenames in Oracle for more information.

Why use BCP and SQL*Loader

Most databases have a 'fast' loader supplied by the manufactuerer. These 'loaders' are designed to take advantage of inside knowledge of the database, to perform bulk loads. No application can match their ability to load data into the database.

By comparison, Uniface's technique is exteremely generic and works for all databases. However it can be quite slow, and exteremely slow when compared with tools like BCP (Sybase and SQL Server) or SQL*Loader (Oracle).

Using the UD8/CSV driver you can write delimited text files for use with these tools, and then take advantage of high speeds loads. This is ideal for large amounts of application data and/or transferring the Uniface repository.

Features comparison

Several other 'text file' drivers are available for Uniface, but this side by side comparison makes it easy to see how UD8/CSV driver offers much more features, and value:

Uniface Versions Supoprted
6.1.dt and higher
For Platforms
Format of file Delimited fields Fixed length fields Fixed length fields
Read & Write simultaneously YES NO NO
 Field level YES NO NO
 Definable packing codes YES NO NO
Binary Data Allowed YES NO NO
Primary Key checking Optional NO NO
Table/File creation on fly YES YES YES
Maximum size of record Unlimited¹ 8192 bytes 8192 bytes
Lock support Whole file NO NO
Retrieve profiles supported YES NO NO
SQL & SQL workbench NO NO NO
Update records from within Uniface YES NO NO
Delete records from within Uniface YES NO NO
Source code available Included NO NO
Can encrypt data to produce test data from production data YES NO NO
Dynamically set filename for an entity. YES NO NO
Dynamically set driver options. YES NO NO
Dynamically set physical tablename for an entity stored in another database. YES NO NO
Artificially set $dbocc() to true for an empty occurrence. YES NO NO
Ignore first row / heading. YES NO NO

Note ¹ : The UD8/CSV driver can store Unlimited size records, within the limitations that Uniface supplied, using base & overflow tables. For a solution to reading CSV files that are larger that 8Kbytes, please see our UD6/CMtool Driver. This driver can read CSV files of any size (please see the explanations in the help file for USYS$UD6_PARAMS=convert csv).

- UD8/CSV driver is available for all Uniface supported platforms
$Revision: 1.8 $ $Date: 2011/02/28 02:56:33 $[go to top]