Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

error Message

edited April 2006 in End User
ppStripOffTableName: Tablename("Commercial_TC")should not be enquoted.
IOB D7 RB10

Error shows when Generating Tables in the Data Dictionary Builder .. Tables.

I have two databases where I am using the end user IBO demo amended for
relevant paths.

The program works fine with one database (gdb file) but not another.
As far as I can tell all parameter settings are identical, just the
paths have changed.

Comments

  • edited April 2006

    - Do you have any other table names with an underline character as part of
    the name? (I am wondering what is different about this table name)

    - My guess is that daIBO.pas, the method TdaIBOSession.GetTableNames is
    returning a list of table names in which some of the names have quotes
    around them. If so, then we add to some code to that method to remove the
    quotes from the string items.

    - Below is an article about how to run the DataDictionary Builder at
    run-time. This can be useful for troubleshooting these types of issues. Add
    RBuilder\Source to your Delphi library path and configure the debugger to
    break on Delphi language exceptions. Then run the DataDictionary Builder at
    run-time and let the debugger break on the exception. Examine the call
    stack.


    -------------------------------------------------------
    Tech Tip: Using the DataDictionary Builder at Run-time
    -------------------------------------------------------

    Is it possible to run the DataDictionary Builder at run-time?

    Example:


    uses
    daDataDictionaryBuilder;


    procedure TForm1.Button1Click(Sender: TObject);
    var
    lForm: TdaDataDictionaryBuilderForm;

    begin
    lForm := TdaDataDictionaryBuilderForm.Create(Application);
    lForm.DataDictionary := ppDataDictionary1;

    if lForm.ValidSettings then
    lForm.ShowModal
    else
    ShowMessage(lForm.ErrorMessage);

    lForm.Free;
    end;


    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2006
    This is a multi-part message in MIME format.
  • edited April 2006
    I have been playing around with this most of today and I must say I am
    stumped.

    I have connected to a number of interbase databases containing "_" in
    the table name. I only have trouble with the database giving rise to the
    error message. (murphy's law of course, it works on everyone you don't
    urgently need ).

    So I have to assume that RB doesn't like something about the database
    but what ?

    I have tried having only a database and ppReport component and try to
    create a dataview at run time. Same problem.

    Incidently as far as i can tell, all other applications using this
    database are running as expected.

  • edited April 2006

    Please do not post any attachments to the newsgroups. Attachments can be
    emailed to support@digital-metaphors.com.

    From looking at the call stack, it appears that a table name
    Cilent_Contact_Record has quotes around it when in it is passed to
    ppStripOffTableName.

    1. The DADE plug-in for IBO, daIBO.pas, is responsible for getting the list
    of available table names from the database. Open this unit and check out the
    method TdaIBOSession.GetTableNames. You will see the following call

    // note: lDatabase is of type TIB_Connection
    lDatabase.SchemaCache.TableNames


    2. Try writing a simple test that uses IBO to get the list of available
    table names and then loops thru the list and checks whether any of the names
    have quotes. Here is an example (I did not compile or test this code).


    var
    lTableNames: TStringList;
    lsTablename: String;

    begin
    lTableNames := TStringList.Create;
    lTableNames.Assign(myIBOConnection..SchemaCache.TableNames);

    for liIndex := 0 to lTableNames.Count-1 do
    begin
    lsTableName := lTableNames[liIndex];

    if (lsTableName[1] = '"') then
    raise Exception.Create('Error: TableName (' + lsTableName + ') should
    not be enquoted.')

    end;






    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2006
    Apologies for delay in responding.

    Ran your procedure and you are correct, most of the table names and
    fields are surrounded by '"'.

    I confirm daIBO.pas has the call
    if lDatabase.Connected then
    alist.Assign(lDatabase.SchemaCache.TableNames);

    in your first reply you state, in regard to names having quotes
    " If so, then we add to some code to that method to remove the
    quotes from the string items."

    Do you have this code available ?

    Regards

    Mike




  • edited April 2006
    O.K. fixed that problem. The quotes are stripped.
    Moved now to the field generator and am receiving 'table not known at
    line 4 column 20'. sql error -204



  • edited April 2006

    - you can remove the quotes by using Delphi's StringReplace routine

    lsTableName := StringReplace(lsTableName, '"', '', [rfReplaceAll]);

    - that error message is generated by the database engine. You need to
    determine what was the SQL statement that was submitted to the database
    engine. My guess is that the database engine is expecting the names to be
    quoted (since that is how it returned the names).





    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2006
    Yes, I expect that's right.

    So are we concluding that RB requires the quotes to be stripped but when
    it passes the tablename to the database engine it needs to surround the
    name in quotes ?

    I don't mind doing that but where in your code do I start ?

    Is there a common procedure called by all instance by RB when it needs
    to parse an sql ?

    Mike

  • edited April 2006

    - The database is wanting the name to be enclosed in quotes and the Dade
    classes are coded to treat a name enclosed in quotes as invalid. Either the
    Dade classes need to be changed to handle tables names with quotes or the
    plug-in, daIBO.pas, has to handle this by stripping off the quotes when it
    builds the list of table names, but them re-adding quotes whenever it
    submits SQL to the database. I don't which of these is easier.

    - If you want to try to change the Dade classes, you could start by
    modifying ppStripOffTableName to not raise an error when it encounters a
    quote. This routine is located in ppUtils.pas

    // comment out these lines
    // if (Length(aRawTableName) > 0) and (aRawTableName[1] = '"') then
    // raise EDataError.Create('ppStripOffTableName: TableName (' +
    aRawTableName + ') should not be enquoted.')

    Try doing that and then run and see what error happens next - if any. (You
    will need to remove the change we made to daIBO, GetTableNames).

    - If you want try to go the other route and change the IBO plug-in, then you
    can leave in the change we made to GetTableNames. Search for the daIBO.pas
    unit for FQuery.SQL. There are two occurences. Some extra code would need to
    be added to re-add the quotes as needed.





    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.