10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How You Can Work with Text StringsFor example, assume your application uses standard text files to store sectionsof a document and stores the names of the files in a database table. You canuse the StringObject attributes and methods that deal with files to manipulatethe strings from your application.The disadvantage of storing strings outside of the database is that you areresponsible for maintaining the string files. You must ensure that any files youreference from the application actually exist, and you must back up andupdate the files appropriately. In addition, if you create a portable applicationor use a network, your application must take into account the differentconventions for file specifications.Storing strings in the database offers the following advantages:• You can take advantage of the DBMS recovery and transaction facilities.• If you use networks, there are no problems with file name transparency.Storing strings in the database, however, has the following disadvantages:• It is difficult for other programs to access the data.To alleviate this problem, after loading the text into the database, use theWriteToFile method to transfer the text back out to a system file formanipulation outside of the database.• There is extra overhead in using the database instead of the native filesystem.The following sections describe how to work with strings stored in files and inthe database.How You Can Store Strings in the DatabaseTo store strings in a database, use OpenROAD to add them to a table.OpenROAD automatically creates a special string storage table, calledii_stored_strings. However, you can create your own storage table if you wantto improve distribution of the strings in the database and avoid transactionbottlenecks.Each string in the storage table is associated with a handle, called aDBHandle, which you use to access the string. For example, to display a stringstored in the database, set the value of the DBHandle attribute to theDBHandle for that string. OpenROAD then displays the string that is associatedwith that particular DBHandle. You must store the DBHandles for the strings ina separate table from the strings themselves.The strings that you load into the database can come from text files, from theuser (who enters them into multiline entry fields), or from StringObjectvariables in your 4GL code.288 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!