Symphony Framework
Symphony.dB Namespace
Inheritance Hierarchy

The Symphony.dB namespace provide powerful relational database capabilities to your existing business applications.  Using the Symphony.dB namespace you can easily migrate your existing ISAM file based data access routines to powerful relational database management capabilities. The Symphony.dB namespace also provides you with powerful data-replication capabilities.

Symphony.dB supports PostgreSQL, Microsoft SQL Server, MySQL and Oracle databases.  Symphony.dB is also royalty free.

To easily replace your ISAM file based access with Symphny.dB to manage your data in one of the supported relational databases you can use the following as a guide.  RCP Consultants can assist with your migration from ISAM to relational database data management.

The Symphony.dB environment uses code-generated structure specific database management routines to map the data from your application "record" area to column based structured data.  Once these have been created you can utilise them to enable your application to manage the data in your chosen database.


The first step is to create an instance of the Symphony.dB DBAccess class. 

    database = new DBAccess("example", "DBMANAGER:DatabaseManager")

To open the "data table" as you would an ISAM file, use the OpenUpdate() or OpenInput() methods;

    error_flag = database.OpenUpdate(channel)

for update mode, or;

    error_flag = database.OpenInput(channel)

For input mode.  Once the "table" has been opened then you can manage the data within the table.  To read the data you can perform various functions, for example;

    error_flag = database.Find(keyValue, D_PRIMARY)
    error_flag = database.ReadFirst(keyOfRef, dataArea)
    error_flag = database.Read(keyValue, keyOfRef, dataArea)

You can store and update data in the table;

    error_flag = database.Store(dataArea)
    error_flag = database.Write(dataArea)

And to delete data from the table;

    error_flag = database.Delete()

The same rules apply as when processing data in an ISAM file - you must, for example, read a record from the table before you can update (Write()) or delete (Delete()) it.  The same "No-Current-Record" errors will be returned if not.


In addition to the standard ISAM style operations you can also query the database using Select style operations.  To perform a "select" query you could use the following example;

    itemDatabase = new dbAccess("item", "DBMANAGER:DatabaseManager")
    itemWhereClause = new WheredB()
    itemWhereClause.Add("code", WheredBConditions.StartsWith, %atrim(code_filters.code_filter))
    itemOrderBy = new OrderBydB("code")
    foreach itemAsString in itemDatabase.Select("code, description, status, def_source_type", itemWhereClause, itemOrderBy)
        item_list = itemAsString

If your application uses generic file handling routines to access your flat ISAM data files the Symphony.dB framework provides a number of methods that can be used to easily migrate that code to accessing data in a relational database.  You can also migrate files one at a time without the need to convert the entire application database.

For example you can modify your generic "file open" routine to check for a specific fie and manage the data in the database for the file;

    if (%instr(1, internalFileName, "USERID.ISM"))
        ;;we are using PostgreSQL so let's open the table on the the file!
        error = Symphony.dB.DBAccess.GenericFileOpen(chan, file, mode)

Now your "channel" references a database table and not a flat ISAM file you can perform the required operations on the data.  The generic routine used to read data, for example, could be changed as such;

    ;;Check if we are accessing data from a database
    if (Symphony.dB.DBAccess.GenericDBCheck(channel))
        keyNumber = 0
        if (^passed(key_no)) then
            ;;use the passed key number
            keyNumber = key_no
            ;;find the key number given the key value
            keyNumber = Symphony.dB.DBAccess.GenericFileKeyCheck(channel, ^argtype(key), ^size(key))
        ;;read the "row" from the database
        err = Symphony.dB.DBAccess.GenericFileRead(channel, key, keyNumber, record)

To store data, use;

    ;;Check if we are accessing data from a database
     if (Symphony.dB.DBAccess.GenericDBCheck(channel))
        ;;store the record data to the database table.
        error = Symphony.dB.DBAccess.GenericFileStore(channel, record)

To update data use;

    ;;Check if we are accessing data from a database
    if (Symphony.dB.DBAccess.GenericDBCheck(channel))
        if(%passed(err))clear err
        error_no = Symphony.dB.DBAccess.GenericFileWrite(channel, record)
        if(%passed(err)) err = error_no

and to delete data from the database table use;

    ;;check to see if this "Channel" is a database channel and not an ISAM channel
    if (Symphony.dB.DBAccess.GenericDBCheck(channel))
        err = Symphony.dB.DBAccess.GenericFileDelete(channel)

The application code which uses your generic file processing routines does not need to change and continues to process the data in the same way.



Class Standard ISAM access to relational database. Providing the ability to migrate your applicaiton data from ISAM to a relational database without having to change the data processing structure and logic of your application provides a powerful migration path to a powerful relational database. Symphony.dB provides a number of classes and method to emulate the ISAM style processing of your existing application.
ClassClass to allow the definition of the order by clause for the DBAccess.Select methods.
ClassThe WheredB class allows the definition of a where clause for the DBAccess.Select methods.
EnumerationThe available responses from DBAccess database processing methods.
EnumerationOrderBydB order sequence enumeration.
EnumerationEnumeration defining the available where clause conditions avaialbe when using the DBAccess.Select method.
Enumeration Define the connectors for multiple where clause operators.
See Also


SymphonyFramework Assembly