Home DADE

Multiple Databases

edited February 2003 in DADE
I know that technically DADE does not support multiple databases. However,
using a data dictionary to supply table & field names, it seems to be
possible to use Paradox aliases (ie., :DBALIAS:table.db) in the table name
in order to access multiple databases in a single query. Now I would like
to do the same thing with remote DBISAM tables (ie., \RemoteDB\table.dat)
but it doesn't work.

Here's the SQL generated with Paradox:

SELECT TTestDB_products.Description,
TTestDB_products.ProductNo
FROM ":TestDB:products.db" TTestDB_products


And with DBISAM (with LocalSQL turned on):

SELECT \TestDB\products.Description,
\TestDB\products.ProductNo
FROM "\TestDB\products" \TestDB\products


The above query generates an error. However, if it did it like it does with
Paradox it would run fine, for example:

SELECT TTestDBISAM_products.Description,
TTestDBISAM_products.ProductNo
FROM "\TestDBISAM\products" TTestDBISAM_products


So, my question is, is it possible to change the DBISAM interface to format
the SQL alias names like Paradox does? Would it be possible to modify
daDBISAM to do this, or is it handled on some other level?

Comments

  • edited February 2003
    Compare daDBBDE.pas to daDBISAM.pas. In the BDE plugin, you should see that
    TdaBDESession.GetDatabaseNames adds aliases, while
    TdaDBISAMSession.GetDatabaseNames just calls inherited. You could try adding
    the remote database to this list in your copy of daDBISAM.pas in this method
    and see if that works. We haven't tested this before. Let us know how it
    goes!


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited February 2003
    After looking at this a little more, it seems that the problem is not
    directly related to DBISAM, but is in the routine that creates the table
    alias itself. It uses a function (daInvalidChar) to strip out invalid
    characters when creating the alias, but "\" is not considered an invalid
    character. Maybe there is a reason for this, though why it would be needed
    in an alias I'm not sure.

    Unit daSQL:

    function daInvalidChar(const aName: String; aDatabaseType: TppDatabaseType):
    Integer;
    const cInvalidChar = [' ', '/', '.', ',', '-', '#', '(', ')', '"', '*', '+',
    '[',
    ']', '{', '}', '~', ';', ':', '`', '?', '<', '>', '|',
    '!',
    '@', '$', '^', '&', '=', '%'];
    cNumerics = ['0','1','2','3','4','5','6','7','8','9'];





This discussion has been closed.